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

Rickey Paape
Rickey Paape
23,992 Points

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.