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

Return true when the valid_command method is passed the following values: "y", "yes", "Y", or "YES.Why my code is wrong?

So much fail is going on right now that I need an exit point from the fail dimension. Please assist me you able minded people because i'm unable to even evaluate this simple request.

def valid_command?(command)

if (valid_command? == "y") || (valid_command? == "yes") || (valid_command? == "Y") || (valid_command? == "YES")

return "true"



1 Answer

Jason Anders
Jason Anders
Treehouse Moderator 145,858 Points

Hey Daniel,

You're on the right track, but there are two errors.

  1. You're checking the condition against the Method instead of the parameter passed into the method. So you can't check valid_command? because it's the method that accepts an argument. So, you need to check the condition against that which is command.
  2. You are returning a string "true" instead of the boolean true. Once you put quotes around something, it becomes a string.

Fix those two things up and you're good to go. :)

Keep Coding! :dizzy: