Skip to content

Instantly share code, notes, and snippets.

@unnu
Created May 30, 2010 15:31
Show Gist options
  • Save unnu/419105 to your computer and use it in GitHub Desktop.
Save unnu/419105 to your computer and use it in GitHub Desktop.
next can be used tor return from a block with return value in Ruby
def foo
2.times do |i|
puts yield
puts "We will go here #{i}"
end
end
foo do
next "Next is the block's return"
"Never returns this"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment