Skip to content

Instantly share code, notes, and snippets.

@aitor
Created July 8, 2010 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aitor/468280 to your computer and use it in GitHub Desktop.
Save aitor/468280 to your computer and use it in GitHub Desktop.
# How to make this more legible?
# n and m are any natural number
n=1; m=12
(n..m).map{|i|[sprintf("%02d", i),i]}
#=> [["01", 1], ["02", 2], ["03", 3], ["04", 4], ["05", 5], ["06", 6], ["07", 7], ["08", 8], ["09", 9], ["10", 10], ["11", 11], ["12", 12]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment