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

what?

??

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

let multi

for results in 1...10 {

    print("\(results) times 6 is equal to \(reslts * 6)")


}

1 Answer

Tobias Helmrich
Tobias Helmrich
31,602 Points

Hey Nils,

firstly you shouldn't fill the results array manually but just leave it as it is. You should then iterate over the range and call the temporary constant in the for-in loop multiplier instead of results .

For the second task you have to append all the multiples of 6 to the results array which you can do by using the append method on the results array and pass it multiplier * 6 .

Like so:

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

for multiplier in 1...10 {

    print("\(multiplier) times 6 is equal to \(multiplier * 6)")
    results.append(multiplier * 6)

}

I hope that helps, if you have further questions feel free to ask! :)