Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Swift 2.0 Collections and Control Flow Control Flow With Loops Looping Over Ranges

The answer for the second objective(if you needs it)

var results: [Int] = []
 for multiplier in results { 
print("the multiple is \(multiplier) times 6, which equal to \(multiplier*6)" 

results.append(multiplier*6)

}
Christian A. Castro
Christian A. Castro
30,501 Points

Hi !! faisal rustom I think you miss something on your answer for the second objective, your code should look like this

var results: [Int] = []
for multiplier 1...10 
{ print("the multiple is \(multiplier) times 6, which is equal to \(multiplier*6)")
results.append(multiplier*6)
}

you just miss the range on the for loop!! thanks, Amaury.

1 Answer

Amaury C. Castro Rivera

Hi could you please explain why thats the answer I struggled on the 2nd objective and have used this to get past the challenge but would like to actually understand it

Thank you Alia