-
-
Save boredzo/7647290 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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