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

Eylon Cohen
Eylon Cohen
4,779 Points

What is wrong with that?

suppose to return true only if the variable is yes

def valid_command?(command) return command.downcase == y||yes end

ruby.rb
def valid_command?(command)
  return command == y||yes||Y||YES
end

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! Your logic is spot on. However, there's still an error here. Because those are not surrounded by quotes, it is looking for variables named y, yes, Y, and YES. And there are no such variables in your code. We need to be comparing to the string values of what you've typed here. Take look:

 return command == "y"||"yes"||"Y"||"YES"

If you add the quotes around these, they become string literals and the challenge should pass. Good luck and happy coding! :sparkles: