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

Paul Je
Paul Je
4,435 Points

Stuck...

Don't know what I should do from here, could anybody help me figure out what I should do to correctly rate a multiplication table onto the constant, "multiplier"? Is that what I'm to do?

loops.swift
// Enter your code below
var results: [Int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

for number in 1...10 = {

let multiplier = "\(number) times 6 is equal to \(number * 6)"

}

2 Answers

Paul, a couple of things. First, you are to use the loop to populate the results array. Second, they asked you to use a constant multiplier to store the value being multiplied by. Third, you don't want a = after the range in the for loop. And finally, there was no request for any Strings.

var results: [Int] = []

let multiplier = 6

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

}

Happy coding.

Paul Je
Paul Je
4,435 Points

Thank you jcorum!! Much appreciated!