break ends the immediately enclosing loop.
loop do puts "Running..." print "Enter q to quit: " gets chomp break if $_ == "q" end