Loop_enum
By accident I discovered that a loop ends when an enumerator is spent (sends StopIteration).
en = %w(olle pelle kalle nisse).to_enum
loop do
p en.next
end
puts 'done!'
Pretty convenient.
By accident I discovered that a loop ends when an enumerator is spent (sends StopIteration).
en = %w(olle pelle kalle nisse).to_enum
loop do
p en.next
end
puts 'done!'
Pretty convenient.