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 trial

Ruby Ruby Operators and Control Structures Logical Operators The And (&&) Operator

marc gumulka
marc gumulka
1,457 Points

I'm not sure I am fully understanding the question presented in the Challenge Question?

The question wants me to return a string value for the check_speed method, however, all I get is syntax errors, and I have gone back to watch the return method videos, but I am feeling a little lost at the moment. Any help, or guidance, is appreciated.

ruby.rb
def check_speed(car_speed)
  puts "Checking #{car_speed}"
  car_speed =45

  if (car_speed == 40) && (car_speed is <= 50)
    return check_speed = "safe"
  else
    puts "driving too fast"  
end
Mauricio Serna
Mauricio Serna
Courses Plus Student 11,090 Points
def check_speed(car_speed) 
  if(car_speed >= 40 && car_speed <= 50) 
    check_speed = "safe" 
  else 
    check_speed = "Driving too fast" 
  end 
end

1 Answer

marc gumulka
marc gumulka
1,457 Points

I see some other had the same question as me, and I see now where I made my mistakes.