Pinnacle Speakers DEKO500 User Manual

Page of 199
Macro Programming Language
123
Deko500 User’s Guide
The assignment operator assigns a value to a variable, and may simultaneously
perform other operations:
Operator
Expression
Operation
=
$a = $b
assigns the value of $b to $a
+=
$a += 1
adds 1 to $a, assigns total to $a
-=
$a -= 5
subtracts 5 from $a, assigns total to $a
*=
$a *= 2
multiplies $a by 2, assigns product to $a
/=
$a /= 2
divides $a by 2, assigns quotient to $a
%=
$a %= 3
divides $a by 3, assigns remainder to $a
>>=
$a >>= 4
shifts $a right 4 bits
<<=
$a <<= 4
shifts $a left 4 bits
%%=
$a %%= "ok"
concatenates “ok” to $a, assigns string to $a
&=
$a &= 2
bitwise AND $a and 2, assigns result to $a
|=
$a |= 2
bitwise OR $a and 2, assigns result to $a
^=
$a ^= $b
bitwise exclusive OR $a and $b, assigns result to
$a
Deko500 uses the same order of operator precedence used by C:
[]
subscript, element
()
parentheses
! ~ -
logical not, one’s complement, unary minus
* / %
multiply, divide, modulo
+ -
plus, minus
<< >>
left shift, right shift
%%
concatenate strings
< <=
> >=
comparisons
== !=
equality, inequality
&
bitwise AND
^
bitwise exclusive OR
|
bitwise OR
&&
logical AND
||
logical OR
= += -= etc.
assignments
Use nested parentheses to avoid ambiguity in expressions. For example:
$inc = ( ($i+1) * ($j+1) ) / 100