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 trialsterlingpitt
492 PointsI'm confused by what the question is asking... what am I missing here?
Any ideas?
// Enter your code below
var results: [Int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
let multiplier: for multiplier in {1...10}
1 Answer
Nathan Tallack
22,160 PointsRighto, first up we are not pre-populating that empty array like you have done. We are going to append to that within our for loop.
Next up we are going to set a constant called multiplier that will be the Int 6 so that we can use that inside our for loop.
Finally we are going to operate a for loop by creating a range from 1 to 10 inclusive and we are going to take that number each pass through the loop and multiply it by that multiplier Int and append the result to our results array.
The code would look something like this.
// Enter your code below
var results: [Int] = []
let multiplier = 6
for num in (1...10) {
results.append(multiplier * num)
}