suve

awful: function: xor

Declaration

bool :xor ( bool $ARG , … )
bool :^^ ( bool $ARG , … )

Summary

Takes any number of arguments and performs a boolean XOR operation on them - which basically means the result will be TRUE if amount of TRUE values is odd, or FALSE if it's even. Arguments which are not booleans will be cast silently.

Example

# Check if number is not 40-something.
:set &NUM i0
:read &NUM
!if :xor (:ge $NUM i40) :lt $NUM i50
    :writeln s"Yay, number isn't in the [40, 49] range."
    !fi

wikipage modified on 2014/0601/2317