dimanche 24 juillet 2016

i'm doing the popular deaf grandma tutorial and couldn't understand my mistake trough other questions so here is the code

puts 'HELLO, SONNY!' #just the intro

answer = gets.chomp #what you answer

while answer != 'NEVER MIND OLD HAG!' or 'BYE' #the loop ( prob where the mistake is)

    if answer == answer.upcase #the conditions
        puts 'NO NOT SINCE ' + (rand(2016)).to_s
    else
        puts 'WHAT? I CAN\'T HEAR YOU!'
    end
end

puts 'SEE YA SONNY BOY' #end of the script

can anyone explain to me what's wrong with the loop/code itself please? thanks in advance :) ( and sorry for the poor grammar im french)

Aucun commentaire:

Enregistrer un commentaire