Skip to content

Instantly share code, notes, and snippets.

@keeran
Created December 1, 2013 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keeran/7740224 to your computer and use it in GitHub Desktop.
Save keeran/7740224 to your computer and use it in GitHub Desktop.
>> i = a.each
=> #<Enumerator: [1, 2, 3]:each>
>> loop do
?> puts i.next
>> end
1
2
3
=> nil
>> i = a.each
=> #<Enumerator: [1, 2, 3]:each>
>> while true
>> puts i.next
>> end
1
2
3
StopIteration: iteration reached an end
from (irb):18:in `next'
from (irb):18
from /Users/keeran/.rvm/rubies/ruby-1.9.3-p448/bin/irb:12:in `<main>'
>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment