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 trialTanner Hildebrandt
1,820 Pointshow do I attach the value of my for in loop to the array using append?results.append(i don't know what to input here)
having trouble attaching value to array using for in loops to create multiples of 6 and attach them to my results array.
// Enter your code below
var results: [Int] = []
for multiplier in 1...10 {
print("\(multiplier) times 6 is equal to \(multiplier * 6)")
}
1 Answer
Simon Di Giovanni
8,429 PointsIt is as simple as this -
results.append(multiplier * 6)
You can then check it's worked correctly, by typing this into the playground
results
In your console you should see all the values calculated
Tanner Hildebrandt
1,820 PointsTanner Hildebrandt
1,820 Pointsthank you simon!