Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

Antony Gabagul
Antony Gabagul
9,351 Points

I have no clue how to approach this problem. Any general guidelines?

Well I just find it hard to start. Don't know where to start exactly or how to do it.

loops.swift
// Enter your code below
var results: [Int] = []

let multiplier = for multiplier in 1...10 {}

1 Answer

Tobias Helmrich
Tobias Helmrich
31,602 Points

Hey Anton,

you almost got it right but the problem in your code is that you're trying to save the loop inside of the multiplier constant. The multiplier constant the description is referring to comes after the for . So if you remove the declaration of the constant in the beginning you already passed the first task! :)

It should look like this then:

// Enter your code below
var results: [Int] = []

for multiplier in 1...10 {

}

I hope that helps, if you have any problems with the second task just let me know and I'll try to help. Good luck! :)