Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
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" end end
Jason AndersTreehouse Moderator 145,631 Points
You're on the right track, but there are two errors.
- 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
- 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. :)