The sequence of statements between the symbols repeat and until is executed at least once. After each execution of the sequence of statements the Boolean expression is evaluated. Repeated execution is continued until the expression becomes true. Because the expression is evaluated for every iteration, you should be careful to keep it as simple as possible. 

program RepeatExample(Input,Output)i { Program 4.4 - Compute the Nth partial sum of the harmonic series H(N) = 1 + 1/2 + 1/3 + + l/N using a repeat statement for iteration. var N: Integeri H: Reali begin Read(Input,N)i Write(Output,N)i H : = Oi repeat H := H + l/Ni N.- N - 1 until N = Oi Writeln(Output,H) end . 

Produces as results: 

102.928968E+00 

The above program performs correctly for N > o. Consider what happens if N <= o. The while-version of the same program is correct for all N, including N = o. 

Note that it is a sequence of statements that the repeat statement executes; a bracketing pair begin ... end would be redundant (but not incorrect) . 

## 4.D.3 The for statement 

The for statement indicates that a statement be repeatedly executed while a progression of values is assigned to the control variable of the for statement. It has the general form: 

