Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Sameet Ahmed
Courses Plus Student 3,586 PointsI'm not sure where I'm going wrong in this question..
def check_speed(car_speed) if (car_speed >= 40) && (car_speed <= 50) return ("safe") elsif (car_speed <=40) && (car_speed >= 50) return ("unsafe") end
def check_speed(car_speed)
if (car_speed >= 40) && (car_speed <= 50)
return ("safe")
elsif (car_speed <=40) && (car_speed >= 50)
return ("unsafe")
end
1 Answer

Tobias Helmrich
31,601 PointsHey Sameet,
you have a few small mistakes in your code. Firstly you forgot to close your if block. The other problem is that the challenge doesn't want you to return "unsafe" in an elsif block so you should just return it in an else block. Also note that your elsif block would never be executed because there is no number that's less than or equal 40 and greater than or equal 50, if you would want to use the elsif block you should use the or (||) operator.
If you write it like this it should work
def check_speed(car_speed)
if (car_speed >= 40) && (car_speed <= 50)
return "safe"
else
return "unsafe"
end
end
I hope that helps, if you don't understand something or have further questions feel free to ask, good luck! :)