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

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