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 trialBen Masel
2,004 PointsCan any one tell me what to put in the loop and if i have made any mistakes in this current program?
Can any one tell me what to put in the loop and if i have made any mistakes in this current program? If so can you tell me why.
// Enter your code below
var results: [Int] = [1]
let multiplier = for results 1...10 { }
Ben Masel
2,004 PointsThank You SOOOOOOOO MUCH!!!
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! The results array is supposed to start off empty. But you've already put a 1 in there. We're going to fill it up programmatically. Inside the loop you'll want to append()
the multiplier * 6
to the empty array. The end result will be that the array will look like this: [6, 12, 18, 24, 30, 36, 42, 48, 54, 60].
Also your for loop is set up incorrectly. It should be for multiplier in 1...10
. This declares a temporary constant/variable named "multiplier". And the 1 to 10 is the range we're looping over. Hope you can get it just with these hints!
Good luck!
Ben Masel
2,004 PointsBen Masel
2,004 PointsThanks yet again!