Skip to content

Instantly share code, notes, and snippets.

@tight
Created February 7, 2012 10:07
Show Gist options
  • Save tight/1758913 to your computer and use it in GitHub Desktop.
Save tight/1758913 to your computer and use it in GitHub Desktop.
for vs each
i = "foo"
for i in 1..5 do
puts i
end
i
# => 5
i = "foo"
(1..5).each do |i|
puts i
end
i
# "foo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment