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 trialKonstantinos Melios
4,427 PointsWhat's wrong!
What is wrong with my code?
def valid_command?(command)
if (command == y) || (command == yes) || (command == Y) || (command == YES)
valid_command? = "true"
end
4 Answers
Colin Marshall
32,861 PointsYour commands should be strings. Also, you are returning a string containing the word "true" when you should be returning a boolean of true.
Kevin Mulhern
20,374 PointsYou need to enclose your yes values in quotes to make them strings, for example:
if (command == 'y')
Konstantinos Melios
4,427 PointsHow to set boolean!
Colin Marshall
32,861 PointsYou just need to put the word true with no quotes around it.
return true
Konstantinos Melios
4,427 PointsThanks!
Konstantinos Melios
4,427 PointsKonstantinos Melios
4,427 Points... other than I forget the end after if!