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

Joseph Maza
9,184 PointsControl Flow Extra Credit
Hi everyone, I was doing the extra credit for this section in Swift basics. I think I have the basic part of it down, but I want it to show numbers in front of the odds and evens. Here's what I have so far thank you for your time.
// Even or Odd to 100
import UIKit
var numbers = 1...100
for number in numbers{ if ((number) % 2 == 0){ println("even") } else if ((number) % 2 != 0){ println("odd") }else { println(number) } }

Joseph Maza
9,184 PointsYes, absolutely helped thank you Danielle Aristizabal!
1 Answer

George Steiner
587 PointsYou could even skip declaring your variable and just write
for i in 1...100 { }
Danielle Aristizabal
10,438 PointsDanielle Aristizabal
10,438 PointsYou can use string interpolation to add the number before Odd or Even. Also you have extra code there that isn't needed. Here is the solution I found:
var numbers = 1...100
for number in numbers { if ((number) % 2 ==0){ println("(number) is even") }else{ println("(number) is odd") } }
I hope this helps!