Loop and exit on key

curious as to how to do so at the click of a button ended the cycle. Аny
infinite loop. Looking for in a search engine, which is not working
examples ... the problem is that the program had worked at the time, it
probably makes no infinite loop, or as something else?

···

--
Posted via http://www.ruby-forum.com/.

Can you rephrase the question in a logical manner, and provide a use
case and example?

···

--
Posted via http://www.ruby-forum.com/.

My program is written in Ruby in the windows, the program runs in the
console, I need to put it in a loop, but if i use key "q" loop cycle
stops.
loop do
break if ....... (key command need)
end

···

--
Posted via http://www.ruby-forum.com/.

That depends on whether you're accepting input via "gets", or you want
something to simply pick up a keypress of "q".

Here's how you could do it with "gets":

···

_______

loop do
  puts 'Enter anything other than "q" to loop:'
  input = gets.chomp
  exit if input == 'q'
  puts 'Looping...'
end

--
Posted via http://www.ruby-forum.com/.

input = gets.chomp
this line pauses code
i need as in your example, but without pause, without stop code.

···

--
Posted via http://www.ruby-forum.com/.

Kernel.trap('INT') { run = false }

while run

end

···

On Fri, Aug 9, 2013 at 8:58 AM, Tamara Temple <tamouse.lists@gmail.com>wrote:

On Aug 9, 2013, at 9:48 AM, gotostereo .. <lists@ruby-forum.com> wrote:

> input = gets.chomp
> this line pauses code
> i need as in your example, but without pause, without stop code.
>
> --
> Posted via http://www.ruby-forum.com/\.

Ruby documentation:

Programming Ruby: The Pragmatic Programmer's Guide

--
- Cliff Rosson

Also this.

···

On Fri, Aug 9, 2013 at 9:15 AM, Cliff Rosson <cliff.rosson@gmail.com> wrote:

Kernel.trap('INT') { run = false }

while run

end

ruby - How can I add a user interrupt to an infinite loop? - Stack Overflow

On Fri, Aug 9, 2013 at 8:58 AM, Tamara Temple <tamouse.lists@gmail.com>wrote:

On Aug 9, 2013, at 9:48 AM, gotostereo .. <lists@ruby-forum.com> wrote:

> input = gets.chomp
> this line pauses code
> i need as in your example, but without pause, without stop code.
>
> --
> Posted via http://www.ruby-forum.com/\.

Ruby documentation:

Programming Ruby: The Pragmatic Programmer's Guide

--
- Cliff Rosson

--
- Cliff Rosson

That depends on whether you're accepting input via "gets", or you want
something to simply pick up a keypress of "q".

Here's how you could do it with "gets":

_______

loop do
puts 'Enter anything other than "q" to loop:'
input = gets.chomp
exit if input == 'q'

break would be better than exit here….

···

On Aug 9, 2013, at 9:02 AM, Joel Pearson <lists@ruby-forum.com> wrote:

puts 'Looping...'
end

--
Posted via http://www.ruby-forum.com/\.

Ruby documentation:

http://docs.ruby-doc.com/docs/ProgrammingRuby/

···

On Aug 9, 2013, at 9:48 AM, gotostereo .. <lists@ruby-forum.com> wrote:

input = gets.chomp
this line pauses code
i need as in your example, but without pause, without stop code.

--
Posted via http://www.ruby-forum.com/\.