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

yusuf Dibswazit
yusuf Dibswazit
1,522 Points

I don't understand.

i don't understand the content of what it's asking me to do. maybe a solution would clarify the question.

loops.swift
// Enter your code below
var results: [Int] = []
for multiplier in 1...10 {
print ("\(multiplier)        \(multiplier * 10)")
}

1 Answer

Tobias Helmrich
Tobias Helmrich
31,603 Points

Hey there,

you were on the right track but you have two mistakes. Firstly you have to append the multiple to the results array with the append method on the results array and not print it out. The second problem is that you need to append the multiples of 6 to the array but you're multiplying the multiplier with 10 instead.

Here is a working solution:

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

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