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 If Statement

David Sheridan
David Sheridan
8,579 Points

I have the correct code and it wont accept it as the right answer

Is this a bug with the site? Keeps telling me to use println when its already there

Please present us your solution, might be a minor problem there.

David Sheridan
David Sheridan
8,579 Points

let months = [1, 2, 3]

for month in months{ if month == 0{ println("January") } else{ println(months) } }

2 Answers

Well, you probably should read the problem statement one more time:

"Print out "January" when you encounter a 1, "February" when you encounter a 2, and finally "March" when you encounter a 3."

Your solution so far only prints "January" if month is 1, else it prints the whole months array. Instead, make two more distinctions, that test, whether month is 2 or 3.

Hope this helps.

You are welcome!