A loop is a piece of code that is executed several times through the use of unconditional (as in GOTO and JMP) or conditional (as in IF-THEN or BNE) branches, or "jumps" back to the beginning of that piece of code.
- Unconditional loops are "tied up" with an unconditional GOTO, JMP, or "conditional" branch that acts on a condition that will always be present, and with no "exits" that may bring the system out of the loop. Such loops continue running until stopped by e.g. the user turning of or resetting the machine.
- Conditional loops keeps looping only until some condition is met, e.g. a number of passes through the loop has been reached, or the user is pressing a key: These have an IF-THEN construct, or a conditional branch instruction, which will at some point let the system "escape" from the loop.
Loops in BASIC
Commodore BASIC V2 has only one structure that directly supports loops; the FOR-NEXT construct. Beyond this, it's up to the programmer to implement his/her own loop structures using conditional or unconditional GOTO statements.