lundi 21 mars 2016

Ruby - If "yes" abc... end if "no" xyz

I am working on a ruby syntax. This is what I have:

query = "Do you like books?"
if query  == "yes" 
  puts "I do too"
end
if  query == "no"
  puts "Movies better"
end

When I save and run this code, nothing happens. I expect it to display either statement based on a yes or no answer. How d I rewrite it to work?

Aucun commentaire:

Enregistrer un commentaire