Skip to content

Instantly share code, notes, and snippets.

@rodrigoflores
Created June 14, 2012 14:14
Show Gist options
  • Save rodrigoflores/2930600 to your computer and use it in GitHub Desktop.
Save rodrigoflores/2930600 to your computer and use it in GitHub Desktop.
# 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
}
@rafaelfranca
Copy link

I prefer to use the { } only when it is an one liner.

@rodrigoflores
Copy link
Author

I've changed the gist :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment