#### ii) Conditional Loops Now for a conditional loop. This is where you don't know in advance how many times you're going to have to go round the loop - you need to loop until something happens to stop the loop, or until a condition is met. type in this program

PROGRAM conditional; {a conditional loop} VAR number : INTEGER; guess : INTEGER; BEGIN number := 5; REPEAT WRITE('enter a number between 0 and 10: '); READLN(guess); UNTIL guess = number; WRITELN('what took you so long?') END.

compile and run the program As you can see, the loop is repeated until the number typed in is 5.
© 2001 by Mike Hardy