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 trialLewis Mansbridge
1,119 PointsHi there, this is my code, I'm a little suck, dont really understand there for in loops at moment, thanks for your help!
Struggling a bit with these for in loops, and also the way the questions are worded get me, have you got any advice for the for in loops? To help? Thank you for your time!
// Enter your code below
var results: [Int] = []
for multiplier in 1...10 {
print(multiplier)
print("\(multiplier) six times tables are \(multiplier * 6)")
}
1 Answer
Anjali Pasupathy
28,883 PointsYou've nearly got it! The structure of your for in loop is perfectly fine.
The question isn't asking you to print out the multiples of 6; it's asking you to append them to the results array. Instead of the print statements in the loop, you should have the following line of code:
results.append(multiplier * 6)
I hope this helps!
Lewis Mansbridge
1,119 PointsLewis Mansbridge
1,119 PointsThank you Anjali !
Anjali Pasupathy
28,883 PointsAnjali Pasupathy
28,883 PointsYou're welcome, Lewis! (: