Created
November 25, 2013 19:30
-
-
Save cbarrett/7647270 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, | |
CountOfOption | |
} | |
/* You want to write a procedure to generate a help message for your program. Here's one way: */ | |
for (int option = 0; i < CountOfOption; i++) { | |
switch (option) { | |
case OptionFoo: | |
/* print foo usage */ | |
break; | |
case OptionBar: | |
/* print bar usage */ | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment