while, until

Prev Next

Function Names

while, until

Synopsis

while (...) {...}
until (...) {...}

Description

Repeats executing statement or block after function name while parameter is true (for while) or false (for until).

Call as: procedure

Restrictions

Indirect parameter passing is disabled

OS differences

None

Parameter count

1

Parameters

No.TypeDescription
1
input
boolean Boolean expression

If the expression is true, then the following statement or block will be executed. Otherwise, it will be skipped.

Default value: n/a

Exceptions

none

Examples

    a[] = 0;
    while ( a[]++ < 10)  print( a[], ' ' );
    until ( a[]-- <= 5)  print( a[], ' ' );
    echo;

Output

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

See also

do
for