THE WHILE LOOP
The while loop is similar to the for loop shown earlier, in that
it allows a {group of} program statement(s) to be executed a
number of times. The structure of the while statement is,
while condition_is_true do begin program statement; program statement end; {semi-colon depends upon next keyword}or, if only a single program statement is to be executed,
while condition_is_true do program statement;The program statement(s) are executed when the condition evaluates as true. Somewhere inside the loop the value of the variable which is controlling the loop (ie, being tested in the condition) must change so that the loop can finally exit.
program WHILE_DEMO (output); const PI = 3.14; var XL, Frequency, Inductance : real begin Inductance := 1.0; Frequency := 100.00; while Frequency < 1000.00 do begin XL := 2 * PI * Frequency * Inductance; writeln('XL at ',Frequency:4:0,' hertz = ', XL:8:2 ); Frequency := Frequency + 100.00 end end. Click here for answer