do
SYNTAX: for iteration_variable := initial_value to final_value do statement
or for iteration_variable := initial_value downto final_value do statement
or
while boolean_expression do statement
or
with list_element[,...] do statement
DESCRIPTION:
"do" is a reserved word in all Pascal standards. It is used for constructing loops during the execution with "for" and "while" statements. The statement following the "do" - the body of the "do" statement - will be executed in cycles according to the controlling iteration variable or boolean expression respectively. Often several simple statements grouped together in a compound-statement as the body of the cycle ("begin statement1; statement2;.... end;").
The later form is for easy access of fields of record or schema type variables. The references in the body of the "do" statement will access the corresponding fields directly in the listed record or schema identifiers.
***** it is rather cryptic. I hardly ever use this feature. correct this section *****
STANDARDS: All.
EXAMPLE:
See the section of the reference under "for", "while" and "with" for the examples.
SEE ALSO: for, while, with
____________________________________
I am waiting for comments.
miklos
According to Miklos Cserzo:
for iteration_variable := initial_value to final_value do statement
or for iteration_variable := initial_value downto final_value do statement or while boolean_expression do statement or with list_element[,...] do statement
or to begin do statement; or ^ Better mention it with or without this one? to end do statement;
(* Module constructors/destructors according to ISO-10206 Extended Pascal. *)
DESCRIPTION:
"do" is a reserved word in all Pascal standards. It is used for constructing loops during the execution with "for" and "while" statements.
... and `with' and `to begin' and `to end'. This is becoming too clumsy.
The statement following the "do" - the body of the "do" statement - will be executed in cycles according to the controlling iteration variable or boolean expression respectively. [...]
This is confusing because it makes people think that `do' by itself has the flavour of a loop.
Better just mention that the reserved word `do' is part of other constructions (`for', `while', `with', `to begin', `to end', ... did I forget something?), heavily cross-refer to them and don't try to explain the details of loops or a `with' statement at this place.
EXAMPLE:
See the section of the reference under "for", "while" and
"with" for the examples.
SEE ALSO: for, while, with
Agreed (modulo `to begin' and `to end'). :-)
Peter