fork download
  1. tri_num = Enumerator.new do |yielder|
  2. number = 0
  3. count = 1
  4. loop do
  5. number = count
  6. count += 1
  7. yielder.yield number
  8. end
  9. end
  10.  
  11. puts tri_num.next
  12. puts tri_num.next
Success #stdin #stdout 0s 4760KB
stdin
Standard input is empty
stdout
1
2