iOS Swift Collections and Control Flow Control Flow With Loops For In Loops

Raymond Choy
Raymond Choy
iOS Development with Swift Techdegree Student 954 Points

I can't understand what is being asked for the second part of this challenge.

I can't understand what is being asked for the second part of this challenge. I need help

loops.swift
// Enter your code below
for multiplier in 1...10 {
    print("\(multiplier) times 6 is equal to \(multiplier * 6)")
}
var results = ["1 times 6 is equal to 6",
"2 times 6 is equal to 12",
"3 times 6 is equal to 18",
"4 times 6 is equal to 24",
"5 times 6 is equal to 30",
"6 times 6 is equal to 36",
"7 times 6 is equal to 42",
"8 times 6 is equal to 48",
"9 times 6 is equal to 54",
"10 times 6 is equal to 60"]

1 Answer

Magnus Hållberg
Magnus Hållberg
12,590 Points

In the second step you are suppsed to append the value calulated from "multiplier" times 6. Like you have done in your print method only using the append method on the results array instead. And of cores only the calculation and not the other text since that results array expects an Int value.

// Enter your code below
var results: [Int] = []
for multiplier in 1...10 {
  results.append(multiplier * 6)
}