The goto command will tell a program to jump to a different spot in a program, where the spot needs to have been marked with label. They both must have the same argument, which is simply a sequence of characters.
Example.
The following program
will add the terms of the harmonic series until the term is less than
some specified value eps and print the result.
harmsum(eps):= { |
local S, j; |
S:= 0; |
j:= 0; |
label(spot); |
j:= j + 1; |
S:= S + 1/j; |
if (1/j >= eps) goto (spot); |
print(S); |
return 0; |
} |