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 trialMatthew Lurie
3,512 PointsAre we using the print function for this?
Totally stuck here.
// Enter your code below
var results: [Int] = []
for multiplier in 1...10 {
multiple = multiplier * 6
}
results.append(multiple)
2 Answers
Jennifer Nordell
Treehouse TeacherHi again! No, there's no need for the print. Remember that thing I said about individual items? In this case, your multiplier is the individual item. The only difference is that it is going over a range. The range is your group. It will start at 1 and go to 10. You are absolutely correct that you need to use the append
method here. Right now, though, you are trying to append something called multiple
(which is an undeclared variable by the way) to the loop after it runs.
Through each iteration of the loop you should be appending the multiplier
times 6 to the results
array. This means that the append
needs to happen inside the loop. You're almost there! I think you can get it with these hints, but let me know if you're still stuck!
Matthew Lurie
3,512 Pointsthank you!