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.

Note sure what I'm doing wrong for this challenge. Can't get the 'check_speed' to pass for a speed less than 45.

I have the following logic:

def check_speed(speed) if speed <= 45 puts "too slow" end if speed > 60 puts "too fast" end if speed > 45 || speed < 60 puts "speed OK" end end

When a speed of less than 45 is passed into the first if statement, it's rejected. Anyone have any ideas?

program.rb
```def check_speed(speed)
unless speed >= 45
puts "too slow"
end
if  speed > 60
puts "too fast"
end
if speed > 45 || speed < 60
puts "speed OK"
end
end
```

Read through the problem, it's pretty straight forward. My mistake was essentially reading through the problem too fast. Below is the code that passed.

```def check_speed(speed)
if speed < 45
puts "too slow"
end
if speed >= 45 && speed <= 60
puts "speed OK"
end
if speed > 60
puts "too fast"
end
end
```

So, for example, if I pass in a speed of say 36, this would evaluate to "too slow" If I pass in a speed of '55', this would evaluate to "speed OK". this is because the speed is GREATER (>) than or EQUAL(==) to 45 AND (&&) LESS (<) than or EQUAL (==) to 60.

If you do this with "45", you'll notice that the first criteria being checked must also coincide with the logic in the second 'if' statement. If you do not add a qualifier of "greater than or equals to >=", the logic will evaluate to both 'too slow' and 'speed OK'. This will fail the check. There can only be one output. Adding the ">=" ensures that there is only one output for the speed check.

Well, what I did was re-read the instructions. It's really a logic question. Just remember that each section all has to correspond to each other.