goto or while()/for()? in Off Topic
There are some uses of the goto construct where a while()/for() would make less sense - implementing finite state machines is the canonical example.
state proc init() update() entered() exited() transition() or_whatever()state/stateMachine var/list/states var/state/current update() current state transition/exit new state enter/action/whateverstate/baddyWander ...state/baddyAttack ...state/baddyRunAway ...state/stateMachine/AI set up wander/attack/run states
#define NUM_STATES 10#define NUM_INPUTS 15int state = 0;outputType *stateAction[NUM_STATES](inputType);int stateTransitionTable[NUM_STATES][NUM_INPUTS];
(Incidental note: C has a pair of calls, 'setjmp' and 'longjmp', that let you jump across calling contexts - that is, you can jump from one function into a completely different function! The original intention was implementing interrupt handlers and exceptions, I think)
There are cases when goto is the only solution without changing a lot things.
How would goto make finite state machines better? I cannot think of a way goto would help with that.
You are perfectly capable of using it, but there really is no really desirable need to use it. It's bad practice and it makes your code look absolutely terrible.
For looping through lists, I use for().
For looping through a timer, I use while().
I never found the need for "goto", and I use while() the most, for() the second most.