StopIteration

class StopIteration

Parent:
IndexError

Raised to stop the iteration, in particular by Enumerator#next. It is rescued by Kernel#loop.

loop do
  puts "Hello"
  raise StopIteration
  puts "World"
end
puts "Done!"

produces:

Hello
Done!

Public Instance Methods

result → value 登录查看完整内容