# Bitwise self-operators

Bitwise self-operators

These operators work only on integer operands.
The syntax is:
<target> |= <right_operand>
<target> &= <right_operand>
<target> ^= <right_operand>
<target> >>= <right_operand>
<target> <<= <right_operand>
<target> must be an existing variable and contain a numeric value. <right_operand> must evaluate to a numeric value. If <target> or <right_operand> are floating point values then they are truncated and converted to integers.
Note that if you want <right_operand> to be a result of an expression, you must enclose it in the $(*) expression evaluation call.
Operator |= computes <target> bitwise-or <right_operand> and stores the result in <target>.
Operator &= computes <target> bitwise-and <right_operand> and stores the result in <target>.
Operator ^= computes <target> bitwise-xor <right_operand> and stores the result in <target>.
Operator >>= shifts <target> <right_operand> bits to the right and stores the result int <target>.
Operator <<= shifts <target> <right_operand> bits to the left and stores the result int <target>.
Note that "!=" is not available. You must use %a = $(!%b) to implement it.
For operators >>= and <<= <right_operand> must be a positive integer.

Examples

        %a = 1
        echo %a
        %a |= 2
        echo %a
        %a &= 2
        echo %a
        %a ^= 1
        echo %a
        %a >>= 2
        echo %a
        %a <<= 1
        echo %a

See also
operators

Index, Language Overview

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