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

"Code Challenge: The And (&&) Operator" doesn't work

Having so many problems with this page. Currently can't even get the cursor to activate in the coding box.

The page also scrolls incorrectly: using the vertical scroll affects the code box, not the page, making it very difficult to position the code box to do work.

I've also entered code, checked the work, encountered error message, and when I make changes and request a recheck, the page times out, returning a communications problem error message and requiring a session restart. Checking internet connection with Internet Frog, the QOS was 90% at the time. This has happened 7 times.

You might of forgotten the end keyword, but if that does not work, this is the code to solve the challenge:

def check_speed(car_speed)
  # write your code here
  if (car_speed >= 40 && car_speed <= 50)
    return "safe"
  else
    return "unsafe"
  end
end

Thanks, xela888 - I did have both end's - one for the method definition and one for the if statement. I was using puts instead of return, and it worked in my sandbox. Any idea why puts wasn't acceptable for the challenge?

Regardless, thanks much for the hint.

Cheers, Susan