# Increment and decrement operations

Increment and decrement operations

These two operators work only on numeric operands. The syntax is: <target>++ <target>-- ++ increments <target> by one, -- decrements <target> by one. These are equivalent to += 1 and -= 1. <target> must be an existing variable and contain an integer value. If <target> contains a real value then the real is truncated to the nearest integer and then incremented or decremented.
Examples

    %a=10
    echo "Incrementing"
    while(%a < 20)
    {
        echo %a
        %a++
    }
    echo "Decrementing"
    while(%a > 10)
    {
        echo %a
        %a--
    }
    echo "Testing for loop"
    for(%a=0;%a < 10;%a++)
    {
        echo %a
    }

See also
operators

Index, Language Overview

KVIrc 4.0.2.4740 Documentation
Generated by root at Tue Feb 1 06:16:04 2011