Skip to content

Instantly share code, notes, and snippets.

@cheald
Created October 23, 2012 05:58
Show Gist options
  • Save cheald/3937079 to your computer and use it in GitHub Desktop.
Save cheald/3937079 to your computer and use it in GitHub Desktop.
tries = [
lambda { puts "1"; false },
lambda { puts "2"; false },
lambda { puts "3"; true },
lambda { puts "4"; true }
]
puts "Found %s" % tries.inject(nil) {|v, l| v ||= l.call }
1
2
3
Found true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment