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 For In Loops

I dont understand this append necessity here

whats wrong here?

loops.swift
// Enter your code below
var results: [Int] = [6,12,18,24,30,36,42,48,54,60]

for multiplier in 1...10 {
print ( " \(multiplier) times 6 is \( multiplier * 6 )")
}

append.results("6")
append.results("12")
append.results("18")
append.results("24")
append.results("30")
append.results("36")
append.results("42")
append.results("48")
append.results("54")
append.results("60")
Yusuf Akbar
Yusuf Akbar
2,457 Points

Hi Raj,

You don't have to add in values for the results array. Simply leave it as is.
The for in loop is perfect and will loop over the correct range.
However you do not have to provide a print statement. Try creating a variable or a constant (name it whatever you like) and use the multiplier constant and multiply it by a value of 6. Then simply append the constant or variable you created to the array.

Hope this helps.

1 Answer

Yusuf Akbar
Yusuf Akbar
2,457 Points

// Enter your code below

var results: [Int] = []

for multiplier in 1...10 {

let six = multiplier * 6

results.append(six)

}