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 trialVidura Rajapaksa
4,512 PointsJust can't figure out what I'm supposed to do
Re-watched the lessons over and over just can't figure out how to append the loop into the array...
// Enter your code below
var results: [Int] = []
for multiplier in 1...10 {
print ("\(multiplier) times 6 is equal to \(multiplier*6)")
}
2 Answers
Tobias Helmrich
31,603 PointsHey Vidura,
good job until here! You almost got it right but the second task of the challenge wants you to append the multiples of 6 to the results array. You can do that by using the append method on the results array like so:
// Enter your code below
var results: [Int] = []
for multiplier in 1...10 {
results.append(multiplier * 6)
}
I hope that helps, good luck! :)
Vidura Rajapaksa
4,512 PointsThanks guys the advice helped heaps! Was trying to tackle the problem from the wrong direction the whole time.
Cheers!
Manuel Aurora
Courses Plus Student 6,338 PointsManuel Aurora
Courses Plus Student 6,338 PointsHi! You must APPEND result into the array. Like this:
for multiplier in 1...10 { results.append(multiplier * 6) }