how does Enumerable#cycle work? (ruby)
Posted
by Radek
on Stack Overflow
See other posts from Stack Overflow
or by Radek
Published on 2010-04-13T21:32:45Z
Indexed on
2010/04/13
23:13 UTC
Read the original article
Hit count: 201
ruby
|enumerable
looper = (0..3).cycle
20.times { puts looper.next }
can I somehow find the next of 3? I mean if I can get .next
of any particular element at any given time. Not just display loop that starts with the first element.
UPDATE Of course I went though ruby doc before posting my question. But I did not find answer there ...
© Stack Overflow or respective owner