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 trialAdrian Filimon
Courses Plus Student 6,668 PointsIt keeps telling me to try again, but there is no error
I tried without using gets, i tried using an elsif statement as well, even it doesn't make sense. I don't get what is missing.
def valid_command?(command)
command=gets
if (command=="y") || (comand=="yes") || (command=="Y") || (command=="YES")
return true
end
end
1 Answer
andren
28,558 PointsThe issue is that you have a typo in the second condition for your if statement, you misspell command
as comand
.
If you fix that typo and remove the gets
function (which does indeed not belong here since the command is passed in as a parameter) then you end up with this:
def valid_command?(command)
if (command=="y") || (command=="yes") || (command=="Y") || (command=="YES")
return true
end
end
Which will pass the challenge.