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 Basics Conditionals "if" Statements

MaryAnn Eleanya
MaryAnn Eleanya
8,626 Points

I am not sure why the program keeps saying that it is not able to find the method name.

Why is the program saying that I did not define the method properly

program.rb
    check_speed =30

if check_speed > 55
  print "too fast"
end

  if check_speed < 55
  print "too slow"
  end

      if check_speed == 55
  print "speed ok"
      end   

1 Answer

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

The check_speed that you've defined here is a variable, not a method. You'll need to define a method with the def keyword:

def check_speed
  # Your code here
end

You might want to review this video and some of the others in Stage 1 before continuing.