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 trialaaron du
5,946 PointsWhy am i wrong?
I just don't know what is wrong with my code, can someone help me??
// Enter your code below
var results: [2,3,4,5,6,7,8,9,10] = [61,12,18,24,30,36,42,48,54,60
]
for multiplier in 1...10{
print (multiplier, "times 6 is " ,multiplier * 6)
}
1 Answer
Aryaman Dhingra
3,536 PointsThe code challenge states you need to append the results of the for in loop to the results collection, but in your code, you're just giving the collection an initial value. To complete the challenge, you have to go through range 1...10
and then append the result * 6 to the results collection. Your code should look a little like this.
var results: [Int] = []
for multiplier in 1...10 {
results.append(multiplier * 6)
}