do

Prev Next

Function Names

do

Synopsis

do { statements } while ( expression );
do { statements } until ( expression )

Description

The statement(s) behind the do function will be executed at least once. The subsquent while and until functions will check whether to repeat executing the statements or not.

Call as: procedure

Parameter count

0

Examples

  a[] = 0;
  do { print( a[], ' ' ); } while ( a[]++ < 10);
  do { print( a[], ' ' ); } while ( a[]++ < 10); // Loop runs at least once more.
  echo;

Output

0 1 2 3 4 5 6 7 8 9 10 11
Try it yourself: Open LIB_Function_do.b4p in B4P_Examples.zip. Decompress before use.

See also

while
until