Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created January 5, 2016 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/2ade2eceaefd088011f5 to your computer and use it in GitHub Desktop.
Save chuck0523/2ade2eceaefd088011f5 to your computer and use it in GitHub Desktop.
[1, 2, 3].each do |e|
puts e # 1 2 3
end
'abc'.chars do |c|
puts c # a b c
end
5.times do |t|
puts t # 0 1 2 3 4
end
5.upto(8) do |u|
puts u # 5 6 7 8
end
5.downto(2) do |d|
puts d # 5 4 3 2
end
2.4.step(5.8, 0.8) do |s|
puts s # 2.4 3.2 4.0 4.8 5.6
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment