Skip to content

Instantly share code, notes, and snippets.

@sspencer
Created October 14, 2009 21:15
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 sspencer/210420 to your computer and use it in GitHub Desktop.
Save sspencer/210420 to your computer and use it in GitHub Desktop.
# Ruby Range Check with Default Value
# if args['level'] is from (-1..9) return args['level], otherwise return -1
level = (-1..9).include?(args['level']) ? args['level'] : -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment