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
juan martinez
40,630 PointsModify the "valid_command?" method to return true when passed the following values: "y", "yes", "Y", or "YES".
answer is : def valid_command?(command) if ( command == "y" ) || ( command == "yes" ) || ( command == "Y" ) || ( command == "YES" ) return true end end
4 Answers
Ricardo Hill-Henry
38,443 PointsJust try refreshing. I just tried it, and it works fine. The only time it didn't work is when I tried the entire method as one line.
Aaron Brooks
1,557 PointsI did the following: def valid_command?(command) if (command.downcase == "y") || (command.downcase == "yes") return true end end
Elias Miller
6,856 Pointsyou can simply that a bit def valid_command?(command) if (command = "y") || ("yes") || ("Y") || ("YES") return true end end
Derrick Phipps
3,560 PointsCan you explain why there are two end's at the end of the method?
Melvin Pacheco
18,880 PointsOne (end) for the method, and one (end) for the if statement inside the method.
def if return end end
Hunter Miller
4,592 PointsHunter Miller
4,592 PointsI am getting an error that says "The "YES" command was not valid