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

Error : Your code couldn't be complied . But if run it in Xcode playground it runs nicely

let multiplier = 6 for table in 1...10 { print["(table) times 6 , which is equal to (multiplier*table)"]

}

loops.swift
// Enter your code below

let multiplier = 6
for table in 1...10 {
 Print["\(table) times 6 , which is equal to \(multiplier*table)"]

}

1 Answer

There are a few things.

  1. The constant on the for loop should be multiplier instead of times
  2. The task asks you too append the results array with the multiplier * 6

As for why it won't compile, this is just an assumption, but the coding emulator on the site may not support operations when doing string interloping. If you replace the print statement with the append property on the array it should compile.