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 Collections and Control Flow Control Flow With Loops Looping Over Ranges

The solution to this challenge?

I am sure this is pretty basic stuff, but for some reason I dont really get what this challenge is asking to do. Any help would be appreciated!!

3 Answers

Never mind, I figured it out. It was pretty silly of me thinking it was actually asking to create a new constant....

this the solution

var results: [Int] = []

for multiplier in 1...10 {

results.append(multiplier * 6)

}

Good catch my friend!

I still need help with that challenge. it has me stumped.

I know this is an old comment, but in case anyone else is having issues with it...

You're pretty much doing exactly what he did in the video with the "for in" loop. Except instead of "number", the name is "multiplier"

so for the first part:

 for multiplier in 1...10 {
}

You're leaving it empty because that's what the challenge asks you to do.

The second part (which is what I needed help on):

If you remember from a few videos back, append is to add something to an array. In this case we're adding the results of the variable multiplier (which is the the loop going 1, 2, 3, 4,.....all the way to 10) times(*)6 And it's as Mustafa Taha above said. So you're whole input will look like:

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