0

Noob question with loops in ruby

Hello Im triying to do a basic program in ruby where i make a loop for only do the next question if the first question is goodly answered but it doesn't work someone can say me why? puts "Dime cuanto dinero quieres gastarte, Âżmucho o poco?" #question 1 respuesta = 0 while respuesta == 0 dinero = gets.chomp if dinero == "mucho" or "poco" #goods answers respuesta = 1 puts "bien contestado" else puts "Las respuestas aceptadas son 'mucho' o 'poco':" respuesta = 0 end end

7th Nov 2016, 5:10 PM
MartĂ­n HernĂĄndez Deincognito
MartĂ­n HernĂĄndez Deincognito - avatar
1 Answer
0
You must write in the condition like this if dinero == "mucho" or dinero=="poco" because the "poco" is not compared to anything.so follow the code above
8th Nov 2016, 9:58 AM
Nazrul Affiq
Nazrul Affiq - avatar