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 trialsarah strange
556 Pointsconfused as to why i need to set the variable to too_fast
not sure how to continue what It is asking me to do
car_speed = 65
speed_limit = 60
too_fast == true
if car_speed > speed_limit
puts too_fast
end
2 Answers
David Cisneros
10,472 PointsIn the instructions it says you need to SET the variable called "too fast" to true if the car_speed variable is greater than the speed_limit variable.
car_speed = 65
speed_limit = 60
too_fast == true
if car_speed > speed_limit
puts too_fast
end
Here, you have too_fast already set to true when it should be set to true in the code block. You have it all setup correctly, you just need to put the too_fast variable in the code block. It should look a little more like this:
car_speed = 65
speed_limit = 60
if car_speed > speed_limit
too_fast = true
end
In this code, you have the code block checking which speed is the greatest number with the too_fast variable ready to be set true if it passes the condition.
Also, == in ruby would be the incorrect way to set a variable to a bolean value. You would use == to access if objects have the same value or not, like this:
car_speed == speed_limit
This is checking if the car_speed and the speed limit have the same value, not setting car_speed value to the speed_limit value.
jacobproffer
24,604 PointsHey Sarah,
You're supposed to set a new variable called too_fast and assign it the value of true if car_speed is greater than speed_limit.
car_speed = 65
speed_limit = 60
if car_speed > speed_limit
too_fast = true
end