Skip to content

Instantly share code, notes, and snippets.

@Denommus
Created March 17, 2013 02:12
Show Gist options
  • Save Denommus/5179244 to your computer and use it in GitHub Desktop.
Save Denommus/5179244 to your computer and use it in GitHub Desktop.
An example of a Closure in Ruby, using code block
x = 5
[1, 2, 3, 4].map { |y| y + x } # returns [6, 7, 8, 9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment