Sorry because this is probably lame but I’ve been trying to think this
one through for a few hours and after a few iterations can’t figure
out the answer. It’s an exercise in the book “Learn to Program”
(Pragmatic)
Anyway, the problem is I want the program to loop and exit on the input
‘BYE’
What’s I’ve come up with is:
$stdout.sync = true (due to weird windows buffer stuff)
input = ‘’
while input != ‘BYE’
input = gets.chomp
if input == input.upcase
puts ‘NO, NOT SINCE 1938!’
elsif input == input.downcase
puts ‘HUH?! SPEAK UP, SONNY!’
end
end
What happens is it does exit on BYE but issues the elsif before
ending. I’ve tried doing a
if input ==input.upcase !BYE , but was thrown an error. I know UNTIL
exists but it hasn’t been introduced in the book yet so want to work
with what I have.
tia
Stuart