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 trialBrendan Ballon
Courses Plus Student 2,728 PointsWhy isn't this code working?
Hello, I and doing a code challenge and I don't exactly know what to do. If someone could please explain to me what is happening that would be great.
// Enter your code below
var results: [Int] = []
for multiplier in 1...10{
print("\(multiplier) times is 6 is \(multiplier * 6)")
}
2 Answers
Jeff McDivitt
23,970 PointsHi Brendan -
You do not need to print anything, the challenge is asking you to append
var results: [Int] = []
for multiplier in 1...10 {
results.append (multiplier * 6)
}
Jeff McDivitt
23,970 PointsIn the for loop 1...10 you are taking the value and multiplying it by default 6 for each value in 1 through 10 you are using the append method to append the multiplier * 6
Brendan Ballon
Courses Plus Student 2,728 PointsBrendan Ballon
Courses Plus Student 2,728 PointsThanks! ?
Brendan Ballon
Courses Plus Student 2,728 PointsBrendan Ballon
Courses Plus Student 2,728 PointsCould someone briefly explain to me what that means?