Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Swift 2.0 Collections and Control Flow Control Flow With Loops For In Loops

Edwin Brown
PLUS
Edwin Brown
Courses Plus Student 1,787 Points

I do not understanding what is being ask for the question.

No additional question

loops.swift
// Enter your code below
var results: [Int] = [1,2,3,4,5,6]
let multiplier: Int 
for multiplier  in results {  print(results[1...10]  )
}
Digvijay Jaiswal
Digvijay Jaiswal
5,565 Points

What are you trying to achieve here?

2 Answers

Arvin San Miguel
PLUS
Arvin San Miguel
Courses Plus Student 3,160 Points

Hi Edwin, It's asking you to put the results of the multiplication table of 6 in the results Array.

// Enter your code below

var results: [Int] = []

for multiplier in 1...10 {
var result: Int = multiplier * 6 // I used this variable in order to return the value and append it to the Results array. print("6 * (multiplier)" + " = (multiplier*6)") results.append(result) }

Try this code. Hope this will help you.

Digvijay Jaiswal
Digvijay Jaiswal
5,565 Points

Arvin San Miguel your answer is correct. I am just putting it in readable format.

var results: [Int] = []

for multiplier in 1...10 {
var result: Int = multiplier * 6 // I used this variable in order to return the value and append it to the Results array. 
print("6 * (multiplier)" + " = (multiplier*6)") 
results.append(result) }