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.

Ruby Ruby Booleans Ruby Booleans Boolean Review

Ruby Boolean

I do not understand what they want in Task 2

boolean.rb
car_speed = 50
speed_limit = 45

if car_speed
  flash_car_speed
else

end

2 Answers

Daniel Cunningham
Daniel Cunningham
21,109 Points

Hey Sara, There is a problem with your "If" statement. As of right now, there is no boolean value being tested. Using "If" statements, just about any value that isnt 0 is going to return "true". Your if condition currently is car_speed... which means you're asking "if 50" to the computer. That will return true. Therefore, regardless of what you put in the 'else' condition, you will always "flash_car_speed". I'm assuming that you want to check if the car speed exceeds the speed limit. So your if statement should be this:

if car_speed > speed_limit

and then complete the conditional statement. Good luck!

Francisco Ruiz
Francisco Ruiz
14,213 Points

Hi Sara - I think under else you just need to put in a call to the method display_car_speed. I am not really sure why that method was given in the Task 1 Question and not in Task 2 - but hope that resolves it