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 trialMarguerite Holden
6,075 PointsDon't understand this challenge of ruby has a bug.
Set a variable called "too_fast" equal to "true" if the car_speed is faster than the speed_limit and "false" if the car_speed is less than the speed_limit.
# W
car_speed = 65
speed_limit = 60
if car_speed > speed_limit
too_fast = true
else
too_fast = true
end
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! The challenge doesn't seem to be bugged.
- You were correct when you had the else too_fast = false
- You've changed the car_speed from 55 as it starts in the challenge to 65. This, of course, affects the outcome.
Give it another shot with these hints in mind!
Marguerite Holden
6,075 PointsThanks for your response. I'll be more careful by resetting code. Your explanations are very good!
Jason Anders
Treehouse Moderator 145,860 PointsHi Marguerite,
There are a couple issues with the code:
You modified the values for the
car_speed
andspeed_limit
that were pre-loaded by the challenge. These need to remain what is set by the challenge.Both the
if
and theelse
are setting the variable to true. Theelse
should be setting the variable to "false"
Fix those up and you're good to go. :)
Keep Coding!
Marguerite Holden
6,075 PointsTh, will be more careful in future challenges.
Marguerite Holden
6,075 PointsMarguerite Holden
6,075 PointsI've also put:
if car speed > speed_limit too-fast = true else too_fast = false end