Skip to content

Instantly share code, notes, and snippets.

@marcelmorgan
Last active January 4, 2016 20:49
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 marcelmorgan/8676609 to your computer and use it in GitHub Desktop.
Save marcelmorgan/8676609 to your computer and use it in GitHub Desktop.
Array of CONSTANTS
# Lets say we need to have a list of all our states
# we could do it like this
ON = 'on'
OFF = 'off'
CLOSED = 'closed'
STATES = [ON, OFF, CLOSED]
# but adding a new state means adding it in 2 places
# versus
STATES = [
ON = 'on',
OFF = 'off',
CLOSED = 'closed',
]
# here we only need to add it once
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment