Last active
August 29, 2015 14:10
-
-
Save fritz0705/29a976bd4a0797bede1e 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
var ( | |
// Zustand des endlichen Automatens | |
state int | |
// Ergebnis™ | |
resistorsPerContainer = 0 | |
containerCount = 0 | |
) | |
for _, arg := range os.Args { | |
switch state { | |
// Startzustand S0 | |
case 0: | |
switch arg { | |
case '--help': | |
PrintHelp() | |
// break ist in Golang implizit | |
case "--resistors-per-container": | |
state = 1 | |
case "--containers": | |
state = 2 | |
default: | |
// error handling | |
} | |
// Zustand für --resistors-per-container | |
case 1: | |
resistorsPerContainer = [...] | |
state = 0 | |
// Zustand für --containers | |
case 2: | |
containerCount = [...] | |
state = 0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment