for

Syntax

for([initialization];<condition>;[operation]) <command>

Description
Performs <initialization> and then enters the following loop:
1) check <condition> , if it evaluates to false , terminate the loop (skip AFTER point 4).
2) execute <command>
3) execute <operation> (that must be a single l-value command!)
4) return to point 1
You can always jump out of the <command> by using break.
[initialization] and [operation] can be empty.
An empty <condition> (unlike other languages) is evaluated to false (treated as empty string); thus if you want an endless loop, you must use for(;1;) or (even better) while(1) that is a lot faster since there is no check for the [operation].
Examples

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

Main index, Command index
KVirc 3.0.0 documentation
Generated by diego at Sat Jul 13 15:37:55 2002