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

I can't my coding error

It keeps returning syntax errors

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

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Ben,

In addition to Ari's point of the missing end, there are also two other errors that will prevent you from passing.

  1. The instructions explicitly ask to return the strings, but you are using puts.
  2. In the if conditional, the second part, you have the word "is" in there for some reason. It should read like the first part (no "is").

Fix up what Ari pointed out, and correct these two, and the challenge will pass.

Keep Coding! :) :dizzy:

Ari Misha
Ari Misha
19,323 Points

Hiya Ben! You forgot to close your "if" statement with "end" keyword. Do that and you're good to go. (: