Skip to content

Instantly share code, notes, and snippets.

@Plutor
Forked from anonymous/for-switch state machine
Last active December 15, 2015 19:29
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 Plutor/5311872 to your computer and use it in GitHub Desktop.
Save Plutor/5311872 to your computer and use it in GitHub Desktop.
Pseudo-code of some code I'm refactoring. WTF.
bool for_switch_state_machine_wtf() {
int state = 1
for(;;) {
switch(state) {
case 1:
if (!do_some_stuff())
return false;
state = 2;
break;
case 2:
if (!do_some_other_stuff())
return false;
return true;
default:
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment