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

Can't figure this one out, it's just telling me the "YES" statement is not valid?

Not sure what I'm doing wrong?

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

I figured it out. Usually I try at it for a good hour before submitting a question. Seems as soon as I submit a question, I figure it out.

1 Answer

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

To begin with you can write most of that on one line. The exercise asks you to return a value of true if any of those are true. But you never return a value at all. See my code for some clarification on what I mean.

def valid_command?(command)
    if(command = "y") || (command = "yes") || (command = "Y") || (command = "YES")
      return true
    end
end

That's exactly what I wrote and passed it right before you commented. This same thing happened to me earlier. Thank you for responding, this place is AWESOME!