## 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.

# Ruby Multiple Conditions - Stage 3 Challenge 1

I cannot figure out the answer to this question. Please help... :-)

Challenge Task 1 of 1

Set the return value of the "check_speed" method to the string "safe" depending on the following condition: The speed passed in as an argument is at least 40. The speed passed in as an argument is less than or equal to 50. You should use the "&&" logical operator to accomplish this task.

ruby.rb
def check_speed(car_speed)
if (car_speed > 40) && (car_speed <= 50)
return "safe"
else
return "unsafe"
end
end

check_speed(45)

Forgot to include the "bummer" message.

Bummer! The check_speed method isn't producing the correct output.

## 4 Answers

Sorry you don't need the parenthesis. The problem is that It must check if it's >=40

You also don't need to call the function.

Ok >= 40 solved the problem. I missed the part "at least" which should include 40. Thanks Charles!

So you need to remove the first parentheses and make sure you close both the if statement and the define method. Here's how I solved it.

def check_speed(car_speed)
if car_speed >= 40 && car_speed <= 50
return "safe"
end
end

I think you need to wrap both conditions in parentheses.

if ( (car_speed > 40) && (car_speed <= 50) )

Thanks for the advice. Unfortunately it still isn't working. Here is another option I tried.

def check_speed(car_speed)
if ((car_speed > 40) && (car_speed <= 50))
return "safe"
end
end

check_speed = check_speed(45)