# if

Flow control command

Usage

    if (<condition>) <command1> [else <command2>]

Description

Executes <command1> if the <condition> evaluates to true (non zero result). If the "else part" is given <command2> is executed if the <condition> evaluates to false (result == '0') <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

    if (<condition>) <command1> [else <command2>]

Examples
if(%a != 10)echo \%a was != 10 else echo \%a was 10!

Index, Commands

KVIrc 4.2.0.6190 Documentation
Generated by root at Mon Sep 23 13:56:02 2013