a:
int i = 0
FOR (; i < # elems-1; ++i)
IF pair(i, i+1) is out of order
swap pair; goto b
RETURN
b:
FOR (; i < # elems-1; ++i)
IF pair(i, i+1) is out of order
swap pair
GOTO a
If the program is running the "b" loop, some pair has been swapped, so when it finishes the loop, it knows to re-run the "a" loop. If the program completes the "a" loop, it knows no pair was swapped, and can finish.
This was extremely convenient for me in the past.