Created
June 14, 2012 14:14
-
-
Save rodrigoflores/2930600 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# do .. end when we're only interested on the side effect | |
array.each do |item| | |
puts item | |
end | |
# { } when we want the result of the evaluation | |
array.map { |item| | |
item + 1 | |
} |
I've changed the gist :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I prefer to use the
{ }
only when it is an one liner.