Skip to content

Instantly share code, notes, and snippets.

@boredzo
Forked from cbarrett/gist:7647270
Last active December 29, 2015 08:59
Show Gist options
  • Save boredzo/7647290 to your computer and use it in GitHub Desktop.
Save boredzo/7647290 to your computer and use it in GitHub Desktop.
/* Let's say you want to list all of the options to your program as an enum */
enum Option {
OptionFoo,
OptionBar
}
/* You want to write a procedure to generate a help message for your program. Here's the loopless/countless way: */
int option = OptionFoo;
switch (option) {
case OptionFoo:
/* print foo usage */
case OptionBar:
/* print bar usage */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment