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 trialAlexander Person
3,593 PointsI do not know how to make this method return true when the parameter passed in is any of the accepted inputs
I do not know how to make this method return true when the parameter passed in is any of the accepted inputs
def valid_command?(command)
if (command == y) || (command == yes) || (command == Y) || (command == YES)
return true
end
end
2 Answers
Daniel Cunningham
21,109 PointsIf those are supposed to be string inputs, you need to put them in single or double quotes. As of right now, it looks like it thinks that command needs to be equal to four variables that you havent defined yet.
Also, if you want to make it case insensitive, you should add "command.downcase!" or "command = command.downcase" in front of the if statement.
Good luck.
Alexander Person
3,593 PointsThank you Daniel. You're help is greatly appreciated. Have a wonderful day! :)