Why am I not successfully breaking from this Ruby loop?

Viewed 77

I am practising Ruby by writing a simple Blackjack game. When the user is asked whether they want to stick or twist, my program seems to insist they have chosen twist even if they explicitly trigger what should be the break. I have abstracted the problem here:

choice = ""
loop do
     print "Press any key to twist. Enter s to stick: "
     choice = gets
     break if choice == "s"
     puts "twist"
end

print "stick"

Any idea what is causing a problem in what should be a very simple piece of code? Whatever I do, I can't get 'stick' to print.

1 Answers
Related