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 trialErik Young
15,016 PointsI'm sure this is correct, I"m just not sure why I'm getting an error Errno::ENOENT
print "How fast were you going?" car_speed = gets.chomp.to_i
if car_speed >= 40 && car_speed <= 50 puts "safe" else puts "unsafe" end
print "How fast were you going?"
car_speed = gets.chomp.to_i
if car_speed >= 40 && car_speed <= 50
puts "safe"
else
puts "unsafe"
end
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHey Erik,
You do have the correct answer (almost)... however it looks like you've deleted some code that was pre-loaded for you (The declaration of the method), and you've added code the challenge did not ask for (The first two lines of the above posted code).
Also, in the if statement
, you are using puts
when the challenge asks you to return
the values. Other than that, the if statement
is correct.
So, if you copy your if statement (don't forget to include the end
for it... change puts
to return
and reset the challenge to the original opening code and paste your if statement
where the challenge says to "write your code here" ... the challenge will pass.
Keep in mind that challenge will always be very specific and very picky. Answers often need to be exactly what is being asked for in the instructions.
Keep Coding! :)