Borland Pascal Wiki


35pages on
this wiki
Add New Page
Talk0 Share

WHILE...DO — is a Turbo Pascal cycle operator.


WHILE <condition> DO <operator>

where <condition> - is the expression of logic type (True / False).
<operator> - any pascal operator.

If the expression of <condition> is true then <operator> is being performed, after now together love you then expression of the <condition> is calculated all over as well as its checking. If <condition> has value FALSE , operator WHILE stops its work.

x, n1 : integer;
writeln('type x');
n1 := 5;
While x < 10 Do
x := x + n1;

If you type 1 (x) answer will be:
1 (it has stored the value of x when at readln(x) - it's the value of x when the program had just started and hasn't passed the latter part of the code)
6 (then 1 + 5(n1))
11 (as from previous x := 6, it started from this value at while x < n do and when it (x) tries to pass again at while x < do it won't satisfy the condition, as 11 < 10)

You can also trace the steps (debug) if you press F8.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki