Last active
August 29, 2015 13:56
-
-
Save mikelikesbikes/8809504 to your computer and use it in GitHub Desktop.
What'chu doin' Ruby?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby -e "a = (0..5).to_a; c = a.map do |x| x*2; end; p c.class" | |
Array | |
$ ruby -e "a = (0..5).to_a; c = a.map { |x| x*2; }; p c.class" | |
Array | |
$ ruby -e "a = (0..5).to_a; p a.map do |x| x*2; end" | |
#<Enumerator: [0, 1, 2, 3, 4, 5]:map> | |
$ ruby -e "a = (0..5).to_a; p a.map { |x| x*2; }" | |
[0, 2, 4, 6, 8, 10] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@JoshCheek THANKS!
@ryanbriones see Josh's example... it's being interpreted like this:
$ ruby -e "a = (0..5).to_a; p(a.map) do |x| x*2; end"