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 Or (||) Operator

I have tried use the 'case' and the 'if' methods and they don't seem to work.

What is the correct way of solving this. I have tried this over and over. and I know that what i have written should work.

ruby.rb
def valid_command?(command)
  if (command == 'YES') || (command == "yes") || (command == "Y") || (command == "y")
    valid_command? == true
  end

end

1 Answer

Hi Jonathan,

Your example is absolutely good except second line.

It should be return true instead valid_command method or just put "true" in either way.

def valid_command?(command)

  if (command == 'YES') || (command == "yes") || (command == "Y") || (command == "y")
    return true
  end

end

Hope that helps.