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 Basics (retired) Control Flow For-In Loop

Brian Patterson
Brian Patterson
19,588 Points

Assistant Editor does not show the right result.

I am going through the course for the second time and with Xcode 7. I have just tried to implement the code from the video and it does not show the right answer in the assistant editor. for number in 1...10 { print("(number) times 2 is (number*2)") } When I type the above it says 10 times and when I try to expand the result it just says "10 times 2 is 20". What am I doing wrong? Is it the version of Xcode? If it is can we have the new videos soon please.

Steven Deutsch
Steven Deutsch
21,046 Points

Hey Brian Patterson,

If you can post a response with your code I'd be happy to take a look. From what you posted above this is the error that I see:

for number in 1...10 { print("(number) times 2 is (number*2)") }

You're missing the backslash "\" character for the string interpolation to work. Remember the format is "()"

for number in 1...10 { print("\(number) times 2 is \(number*2)") }

This should solve the problem I hope!

Goodluck!

1 Answer

Brian Patterson
Brian Patterson
19,588 Points

Worked it out. Swift 2.0 shows assistant editor at the bottom of the screen.