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.

julianacrispo
4,105 Points"Set a variable called "too_fast" equal to "true" if the car_speed is faster than the speed_limit." Why is answer wrong?
My answer was: if car_speed > speed_limit too_fast = "true" end
10 Answers

Ricardo Hill-Henry
38,442 PointsUse the boolean value true, not a string value "true".

Carl Sergile
16,570 Points car_speed = 55speed_limit = 60
if car_speed > speed_limit
too_fast = true
else
too_fast = false
end
THIS IS IT.

Roscoe Coney
13,124 Pointstype the following:
too_fast = true

missfit
18,561 PointsHey I came across this post and none of the answers above worked for me, however the code I typed in below finally worked. Hope that helps someone.
car_speed = 55 speed_limit = 60 too_fast = car_speed > speed_limit
if too_fast puts "true" else puts "false" end

missfit
18,561 PointsHey I came across this post and none of the answers above worked for me, however the code I typed in below finally worked. Hope that helps someone.
car_speed = 55 speed_limit = 60 too_fast = car_speed > speed_limit
if too_fast puts "true" else puts "false" end

missfit
18,561 PointsHey I came across this post and none of the answers above worked for me, however the code I typed in below finally worked. Hope that helps someone.
car_speed = 55 speed_limit = 60 too_fast = car_speed > speed_limit
if too_fast puts "true" else puts "false" end

ellie adam
26,376 Pointsthis works
too_fast = true

Maciej Czuchnowski
36,440 PointsThe section is called "control structures", so you were supposed to use an if
statement to get that result, assuming that the variable values may be different in the future, n which case your code would fail the expectation.

Jeremy Kerrigan
12,002 PointsThis is the answer and I believe it is the structure they want.
car_speed = 65 speed_limit = 60 too_fast = true //Set a variable called "too_fast" equal to "true"
if car_speed > speed_limit //if the car_speed is faster than the speed_limit. puts too_fast end

Nasser Sanou
6,835 PointsThis works as well!
car_speed = 55 speed_limit = 60
if car_speed > speed_limit too_fast = true else car_speed < speed_limit too_fast = false end

Ben Holland
Courses Plus Student 4,062 Pointsif car_speed > speed_limit
too_fast = true
end
That is the answer.
Maciej Czuchnowski
36,440 PointsMaciej Czuchnowski
36,440 PointsAnd make sure these are 3 separate lines, it won't work as one line.
Aurelien Schlumberger
6,127 PointsAurelien Schlumberger
6,127 Points@Maciej Czuchnowski, not that your answer is wrong, but actually you could do it in one line in Ruby and is still good design. ```ruby : too_fast = true if car_speed > speed_limit
Maciej Czuchnowski
36,440 PointsMaciej Czuchnowski
36,440 PointsI know, I was referring to the code that Juliana showed, with
end
at the end :)