Macro Programming Language 157
FXDeko User’s Guide
OPERATORS
In the previous topic, you saw that variable assignment is indicated by the equal
sign (=), which is just one of many symbols, known as operators, that represent
operations performed on data.
The FXDeko Macro Programming Language uses a subset of the operators
available in C, as well as a few additions specific to FXDeko.
Arithmetic operators perform mathematical operations within expressions:
Operator Expression Operation
+ $a + $b adds $a and $b
- $a - $b subtracts $b from $a
* $a * $b multiplies $a by $b
/ $a / $b divides $a by $b
% $a % $b calculates remainder of $a/$b
- -$a negates the value of $a
You can perform arithmetic operations on one-character strings by adding or
subtracting integer values to the character. For example, the expression "A"+1
has the value "B".
Using single quotation marks in an expression yields the numerical value of the
character key. For example, ’A’+1 has the value 66.
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 !=.