# Changing the order of execution: goto label

### 12.3.8 Changing the order of execution: goto label

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.

- label takes one argument:
  mark, a sequence of characters.
- label(mark) labels the position in the program with mark.

- goto takes one argument:
  mark, a sequence of characters.
- goto(mark) goes to the part of the program labeled with mark.

#### 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;
}