Skip to content

Instantly share code, notes, and snippets.

@randallreedjr
Created March 6, 2016 22:33
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/2ce43634b33c0cfa5573 to your computer and use it in GitHub Desktop.
Save randallreedjr/2ce43634b33c0cfa5573 to your computer and use it in GitHub Desktop.
Third code sample for post Ruby Abstraction in Loops
array = [1,2,3]
squares = []
array.each do |element|
squares << element ** 2
end
squares
# => [1,4,9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment