Skip to content

Instantly share code, notes, and snippets.

@fdelacruz
Created August 7, 2014 00:34
Show Gist options
  • Select an option

  • Save fdelacruz/1ec0eb8a2e896a50af58 to your computer and use it in GitHub Desktop.

Select an option

Save fdelacruz/1ec0eb8a2e896a50af58 to your computer and use it in GitHub Desktop.
array = [1, 2, 3, 4]
array.collect! do |n|
n ** 2
end
puts array.inspect # => [1, 4, 9, 16]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment