# while

Iteration command

Usage

    while (<condition>) <command>

Description

Executes <command> while the <condition> evaluates to true (non zero result).
<command> may be either a single command or a block of commands.
It can contain the break command: in that case the execution of the <command> will be immediately interrupted and the control transferred to the command following this while block.
It is valid for <command> to be an empty command terminated with a ';'. <condition> is an expression as the ones evaluated by [doc:expressioneval]$(*)[/doc] with the following extensions:
If <condition> is a string, its length is evaluated: in this way a non-empty string causes the <condition> to be true, an empty string causes it to be false.
If <condition> is an array, its size is evaluated: in this way a non-empty array causes the <condition> to be true, an empty array causes it to be false.
If <condition> is a hash, the number of its entries is evaluated: in this way a non-empty hash causes the <condition> to be true, an empty hash causes it to be false.

Syntax Specification

    while (<condition>) <command>

Examples

    %i = 0;
    while(%i < 100)%i++
    while(%i > 0)
    {
        %i -= 10
        if(%i < 20)break;
    }
    echo %i

Index, Commands

KVIrc 4.2.0.6190 Documentation
Generated by portbuild at Mon Aug 12 23:49:50 2013