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 trial

iOS Swift 2.0 Collections and Control Flow Control Flow With Loops Looping Over Ranges

I'm having trouble understanding how to append the value of the results to pass the 2nd part of the chanllenge

When I'm trying t complete the challenge var results: [Int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]for multiplier in results { print("(multiplier) times 6 is equal to (multiplier * 6)") }

I keep getting the error that says make sure you are storing the multiplier up to times in the results. I've tried several times. Still cant get it

2 Answers

Hi try this :)

var results: [Int] = []

for multiplier in 1...10{

multiplier * 6

results.append(multiplier * 6) }

this will make it 20 times! because you write 2 times the "multiplier * 6" the right is

var results: [Int] = []

for multiplier in 1...10 {results.append(multiplier * 6) }

(the code challenge don't recognise it! both are right for the code challenge ..but if you write it to the xcode you will see the deference.)

thanks.. that works!! Much appreciated

no worries let me know if you need help with anything :)