Macro Programming Language 122
Deko500 User’s Guide
Comparison operators compare values and determine whether an expression is true
or false. An expression is any combination of variables, commands and operators that
results in a single value.
An expression is true if its value is non-zero; it is false if its value is 0.
Operator Expression Value
== $a == $b True if $a equals $b
> $a > $b True if $a is greater than $b
>= $a >= $b True if $a is greater than or equal to $b
< $a < $b True if $a is less than $b
<= $a <= $b True if $a is less than or equal to $b
!= $a != $b True if $a does not equal $b
! !$a True if $a is false (equals 0)
&& $a && $b True if both $a and $b are true
|| $a || $b True if either $a or $b is true
There is one string operator, for concatenation of strings:
Operator Expression Operation
%% $a %% $b joins string $b to the end of string $a
Strings can be compared for equality and inequality using the comparison operators
== and !=.
Additional string operations are performed by commands. Please refer to the Deko500
Commands section of this manual.
The index and element operators allow direct access to values that are elements of
arrays or elements of objects:
Operator Expression Data Accessed
[ ] $a[$b] item $b of array $a
: $a:$b $b element of object $a
Bitwise operators perform operations on integers based on bit position:
Operator Expression Operation
<< $a << 2 shifts $a left by 2 bit positions
>> $a >> 4 shifts $a right by 4 bit positions
~ ~$a complements 1 bits to 0; 0 bits
to 1
& $a & $b bitwise AND of $a and $b
| $a | $b bitwise OR of $a and $b
^ $a ^ $b exclusive OR of $a and $b