Skip to content

Instantly share code, notes, and snippets.

@shinokada
Created June 26, 2014 12:48
Show Gist options
  • Save shinokada/d451f7b44ce628ddd3ec to your computer and use it in GitHub Desktop.
Save shinokada/d451f7b44ce628ddd3ec to your computer and use it in GitHub Desktop.
r = 10..1
p (r.first).downto(r.last).to_a
# [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
p (1..10).reverse_each.to_a
# [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment