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

Im stuck on this question any help?

1 Answer

Jake Adams
Jake Adams
1,608 Points

You want to fill the results array with 10 integers that are all multiples of 6. So you need to build a for in loop that gives you a multiplier from 1 through 10 (including 10). And then you store the value of multiplying 6 by that multiplier in the results array.

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

// each value 1 through 10 will be stored in 'multiplier'. The 3 dots (...) indicate that we want a range from 1 to 10, including 10
for multiplier in 1...10 {
  results.append(multiplier * 6)
}