[Contents] · [Home] · [Mail]

SALIERI Language - loopn

Type:
loopn: integer x stmnt_block -> ()

Call syntax:
loopn(cnt, bodyBlock)

Description:
The control function loopn executes the loop body bodyBlock exactly cnt times (for cnt >= 0).

Error conditions:
If cnt <= 0, the loop body is not executed; no error condition occurs.

Attention!
loopn is much more efficient than the other loop control structures; therefore, for performance optimisation, it should be used whenever the number of loop-executions is known before entering a loop.

Example:
> i := 0; loopn(3, `write("Gott ist tot, sprach Zarathustra zum ", i, ". mal!"´))
Gott ist tot, sprach Zarathustra zum 1. mal!
Gott ist tot, sprach Zarathustra zum 2. mal!
Gott ist tot, sprach Zarathustra zum 3. mal!
> i := 0; loopn(-3, `write("Gott ist tot, sprach Zarathustra zum ", i, ". mal!"´))

See also: loop, while, if.


[Contents] · [Home] · [Mail]
© sic!systems, page frame designed by hh; this page has been automatically generated from the SALIERI Documentation Database.