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 trialCody Bouscaren
3,070 PointsI'm a bit confused about what this challenge is asking me to do. I'm not sure how to advance, as my code is wrong
I'm specifically confused about the 'set the return value' of the method to true portion.
def check_speed(car_speed)
# write your code here
if (car_speed >= 40) && (car_speed <= 50)
check_speed = "safe"
end
3 Answers
William Li
Courses Plus Student 26,868 PointsYou got the logic of the code right, but here're couple of issues
- missed the
end
for if condition - no return value. By default, in Ruby the last statement in method definition is the return value, but
check_speed = "safe"
is just a value assignment.
Set the return value of the "check_speed" method to the string "safe"
def check_speed(car_speed)
# write your code here
if (car_speed >= 40) && (car_speed <= 50)
"safe"
end
end
Konrad Pilch
2,435 PointsHI, i dont know but, you can press a big arrow to go to next exercise or if this is the last one, click on the course and just look on sections and you can enter any video you like.
Jesus Mendoza
23,289 PointsHello, you have to return a value using the return statement
def check_speed(car_speed)
# write your code here
if (car_speed >= 40) && (car_speed <= 50)
check_speed = "safe"
return check_speed
end
end