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 trialRicardo Gonzalez
2,286 PointsHow do I add the for in loop to the variable results?
Don't know how to finish challenge.
var results: [Int] = []
for multiplier in 1...10 {
print("\(multiplier) times 6 is equal to \(multiplier * 6)")
}
1 Answer
Jennifer Nordell
Treehouse TeacherYou've set up your for loop just fine! However, the challenge doesn't ask you to print anything. They want you to take multiplier and multiply it by 6 then put that into the results array. So the end result array will contain 6, 12, 18, 24, 30, 36, 42, 48, 54, 60. Here's how I did it:
// Enter your code below
var results: [Int] = []
for multiplier in 1...10 {
results.append(6 * multiplier)
}
They set up the results array for you. Your job is simply to take the result of 6 * multiplier and put it in the array. Hope this helps!
Ricardo Gonzalez
2,286 PointsRicardo Gonzalez
2,286 PointsOh ok I see. Thanks A lot!