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 trialAdam Blomberg
700 PointsI don't get how i'm supposed to use the results array
I've tried a number of different ways to solve this task but I didn't come across how to solve it.
// Enter your code below
var results: [Int] = []
for multiplier in 1...10 {
print("\(multiplier) times 6 is equal to \(multiplier * 6)")
}
2 Answers
Jennifer Nordell
Treehouse TeacherYou're printing out the results which isn't what they want. They want the results array to contain the results So the first time through the loop it should append 6 to the array. Then 12... all the way up to 60. Take a look at my solution:
// Enter your code below
var results: [Int] = []
for multiplier in 1...10 {
results.append(multiplier * 6);
}
At the end the results array should look like this [6, 12, 18, 24, 30, 36, 42, 48, 54, 60]. Hope that clarifies things!
Adam Blomberg
700 PointsIndeed, it's always fun to discover coincidences :D
Adam Blomberg
700 PointsAdam Blomberg
700 PointsOkay, thank you that was exactly what I needed. It did work out well and I passed the challenge. But sometimes it can be hard to understand. You see english is my second language and i'm only 14.
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherYou're doing great! And your English is excellent (as far as I can see). As a note: I'm in the reverse position. English is my first language and Swedish is my second :)