Skip to content

Instantly share code, notes, and snippets.

@wbailey
Created December 21, 2010 07:55
Show Gist options
  • Save wbailey/749633 to your computer and use it in GitHub Desktop.
Save wbailey/749633 to your computer and use it in GitHub Desktop.
A trick using a negative array index
1.upto(10) {|i| puts %w{current after before}[i <=> 5]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment