| Up | Next | Prev | PrevTail | Tail |
repeat… until is very similar in purpose to while… do. Its syntax is:
repeat 〈statement⟩ until 〈boolean expression⟩(PASCAL users note: Only a single statement – usually a group statement – is allowed
between the repeat and the until.)
There are two essential differences:
while… do.As an example, we rewrite the example from the while …do section:
ex:=0; term:=1; repeat <<ex := ex+term; term := (term + term^2)/3>> until num(term - 1/1000) < 0; ex;
In this case, the answer will be the same as before, because in neither case is a term
added to ex which is less than 1/1000.
| Up | Next | Prev | PrevTail | Front |