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 trialPeter Zhuwawo
6,734 Pointsif statement If the s
We've updated our previous CheckSpeed method to return a string value. Update the method body with this logic:
If the speed parameter is over 65, return the string "too fast". If the speed parameter is under 45, return the string "too slow". Otherwise, return the string "speed OK".
Tineyi Chinhengo
30,770 Points// YOUR CODE HERE if(speed > 65) { return "too fast"; } else if(speed <45) { return "too fast"; } else { return "speed OK"; }
2 Answers
Sean Bridges
1,502 PointsHeaven forbid you type ok in lieu of OK...makes you feel dumb for about two minutes
Nuno Reis
23,956 PointsLol, thanks for this comment! Got bitten by the same "mistake".
Steven Parker
231,269 PointsThe suggestion by Tineyi is very close! Except for this part:
else if (speed <45) { return "too fast"; }
I think you meant for this test to say "too slow" instead.
Steven Parker
231,269 PointsSteven Parker
231,269 PointsPlease give it your best "good faith" try, and then post your code along with the question (and a link to the course page) if you need help.