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

Derrick Williams
PLUS
Derrick Williams
Courses Plus Student 1,075 Points

logical operators challenge

I'm not sure where i'm going wrong here

ruby.rb
def check_speed(car_speed)
  # write your code here
  if (car_speed > 39) && (car_speed <= 50)
    puts "safe"
 end

3 Answers

Hi Derick,

Great try and almost, however, I will give you hints to check several errors.

  • remove two brackets in if statements
  • remove `puts' which will automtically return
  • missing one more 'end' on the bottom
Derrick Williams
PLUS
Derrick Williams
Courses Plus Student 1,075 Points

Thank you. I'm not sure why 'end' was used twice, but it worked

Because you see definition on first line def which require end tag and now you put if statement that require another end tag. Yup, twice ends. :)