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 trialKelvin Spencer
1,742 PointsIt seems there is an error, I am typing else if car_speed == speed_limit... and it is not accepting the addition.
car_speed = 55 speed_limit = 55
if car_speed < speed_limit too_fast = false else if car_speed == speed_limit going_speed-limit = true else too_fast = true end
car_speed = 55
speed_limit = 55
if car_speed < speed_limit
too_fast = false
else if car_speed == speed_limit
going_speed-limit = true
else
too_fast = true
end
3 Answers
Cena Mayo
55,236 PointsAck - missed the big one here:
there is no 'else if' in Ruby. It's elsif.
Cena Mayo
55,236 PointsLooks like you're doing this:
going_speed-limit
instead of this:
going_speed_limit
Make sure there's an end statement for the If-elsif-else loop :)
Kelvin Spencer
1,742 Pointsupdated the following line: going_speed_limit = true , still not processing
a20ff730-5ad3-4da2-92c9-817f291051ae.rb:15: syntax error, unexpected end-of-input, expecting keyword_end
car_speed = 55 speed_limit = 55
if car_speed < speed_limit
too_fast = false
else if car_speed == speed_limit
going_speed_limit = true
else
too_fast = true
end
Kelvin Spencer
1,742 PointsSolved: I was typing "else if" instead of "elsif"
Cena Mayo
55,236 PointsJinx! :) Glad you got it sorted.
Kelvin Spencer
1,742 PointsKelvin Spencer
1,742 Pointsupdated the following line: going_speed_limit = true , still not processing
a20ff730-5ad3-4da2-92c9-817f291051ae.rb:15: syntax error, unexpected end-of-input, expecting keyword_end