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 Looping Over Ranges

Kevin Bullis
Kevin Bullis
13,770 Points

Error in xcode for for number in 1...10 example

In Looping with Ranges Pasan gives an example in xCode for the range 1...10.

I think I've copied it exactly, but get error messages in xCode.

Here's what I wrote. What did I miss?

```Swift 2.0 for number in 1...10 { print("(number) times 5 is equal to (number * 5)" }

the error says it's expecting a separator
Kevin Bullis
Kevin Bullis
13,770 Points

Ooops. I found the error. Missing parenthesis.

2 Answers

Kevin Bullis
Kevin Bullis
13,770 Points

add a paranthesis after the second quotation mark

Sam Chaudry
Sam Chaudry
25,519 Points

Sees fine to me I check in Swift 2.1 and Xcode 7.1 and it outputted in the console

using this code

for number in 1...10 {

    print("\(number) times 5 is equal to \(number * 5)")

}

1 times 5 is equal to 5 2 times 5 is equal to 10 3 times 5 is equal to 15 4 times 5 is equal to 20 5 times 5 is equal to 25 6 times 5 is equal to 30 7 times 5 is equal to 35 8 times 5 is equal to 40 9 times 5 is equal to 45 10 times 5 is equal to 50