# Expression evaluation identifier Expression evaluation identifier
Usage
    $(<expression>)
Description
Evaluates <expression> and returns its result. If <expression> is a single string, array or hash, it is returned unmodified. In any other case the expression evaluation returns a numeric value, either real or integer. The expressions are really close to the C ones and have some minor extensions. The supported operators are +,-,*,/,|,&,^,||,&&,^^,>>,<<,<,>,<=,>=,==,!= and <> (synonim for !=). The following table describes their meaning.
Operator | Description
a + b | Arithmetic sum: valid only for numeric operands
a - b | Arithmetic subtraction: valid only for numeric operands
a / b | Arithmetic division: valid only for numeric operands
a * b | Arithmetic multiplication: valid only for numeric operands
a % b | Arithmetic modulus: valid only for numeric operands
a || b | Logical or: valid only for boolean operands
a && b | Logical and: valid only for boolean operands
a ^^ b | Logical xor: valid only for boolean operands
a >> b | Bitwise shift right: valid only for integer operands
a << b | Bitwise shift left: valid only for integer operands
a | b | Bitwise or: valid only for integer operands
a & b | Bitwise and: valid only for integer operands
a ^ b | Bitwise xor: valid only for integer operands
a > b | Greater than: valid for numeric or string operands. Case sensitive
a < b | Lower than: valid for numeric or string operands. Case sensitive
a >= b | Greater or equal to: valid for numeric or string operands. Case sensitive
a <= b | Lower or equal to: valid for numeric or string operands. Case sensitive
a != b | Not equal to: valid for numeric or string operands. Case sensitive
a == b | Equal to: valid for numeric or string operands. Case sensitive
The expressions can contain integer, real or string constants and variable operands. The integer constants can be also specified as hexadecimal numbers by prefixing them by '0x'. The string constants should be enclosed in quotes.
Syntax Specification
    $(<expression>)
Examples
        echo $(10 + 5 * 100)
        echo $(10 / 3)
        echo $(10 / 3.0)
        echo $(10.0 + 5 * 100)
        echo $(145 & 2)
        echo $("hello" > "ciao")
        echo $(10 == "10")
        %a = 100
        %b = 50.3
        %c = "test"
        echo $(%a + %b)
        echo $("%a%b" + 1)
        echo $(%a + %b > %c)
        echo $(-(10 + 20) * 3)
        echo $(1 ^ 2)
        echo $(1 ^ 1)
        echo $(0xffff == 65535)
        ...

Index, Language Overview

KVIrc 4.2.0.6190 Documentation
Generated by root at Tue Sep 24 07:25:10 2013