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 trialDavid Sheridan
8,579 PointsI 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
David Sheridan
8,579 Pointslet months = [1, 2, 3]
for month in months{ if month == 0{ println("January") } else{ println(months) } }
2 Answers
Stefan Cimander
37,115 PointsWell, 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.
David Sheridan
8,579 Pointsoops, my bad! Thanks!
Stefan Cimander
37,115 PointsYou are welcome!
Stefan Cimander
37,115 PointsStefan Cimander
37,115 PointsPlease present us your solution, might be a minor problem there.