Ruby/Statement/loop

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск

The loop Method

# The loop method comes from Kernel. 
# It lets you run a loop continuously like running for(;;) until you or the program does something to break out of the loop.
loop do
  print "Type something: "
  line = gets
  break if line =~ /q|Q/
  puts line
end