Skip to content

Instantly share code, notes, and snippets.

@rodrigopinto
Last active December 11, 2015 19:48
Show Gist options
  • Save rodrigopinto/4650596 to your computer and use it in GitHub Desktop.
Save rodrigopinto/4650596 to your computer and use it in GitHub Desktop.
original = [2, 3, 5, 10].tap do |arr|
arr.map { |v| v*v }.tap {|x| puts "squares: #{x.inspect}"} # => squares: [4, 9, 25, 100]
end
puts "original: #{original.inspect}" # => original: [2, 3, 5, 10]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment