Skip to content

Instantly share code, notes, and snippets.

@randallreedjr
Created March 6, 2016 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save randallreedjr/4c436cbf8c19cf05aba7 to your computer and use it in GitHub Desktop.
Save randallreedjr/4c436cbf8c19cf05aba7 to your computer and use it in GitHub Desktop.
Fifth code sample for post Ruby Abstraction in Loops
array = [1,2,3]
array.collect do |element|
element ** 2
end
# => [1,4,9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment