There are three types of operators that can be used in programs:
Calculation Operator
In the table below, the calculation result assumes variable A
is 3 (0000 0000 0000 0011), and the variable B
is 4 (0000 0000 0000 0100).
Remainder calculation and all Bitwise calculations will be performed with 32-bit integer data.
Operator | Function | Example | Description |
| Bitwise invert |
| Each bit of |
| Addition |
| Variable |
| Subtraction |
| Variable |
| Multiplication |
| Variable |
| Division |
| Variable |
| Remainder |
| Indicates the remainder from the division of |
| Bitwise AND |
| Bitwise logical AND calculation of |
| Bitwise OR |
| Bitwise logical OR calculation of |
| Bitwise XOR |
| Bitwise logical XOR calculation of |
| Bitwise Shift Left |
| Shifts the bits of |
| Bitwise Shift Right |
| Shifts the bits of |
Logical/Comparative Operator
In the table shown below, the calculation result assumes that variable A
is 1 (True) and variable B
is 0 (False). In Canvas, the values other than 0 are all processed as True. Only 0 is recognized as False.
When the calculation result is true, the result is always 1.
Operator | Function | Example | Description |
| Logical AND |
| If value in variables |
| Logical OR |
| If value in variables |
| Less than |
| If |
| Greater than |
| If |
| Less than or equal to |
| If |
| Greater than or equal to |
| If |
| Equal to |
| If |
| Is not equal to |
| If |
Other Operator
Operator | Function | Example | Description |
| Store |
| Stores the value in variable |
The Store =
operator can be used consecutively.
A = B = C;
In this case, the value of A
and B
will be set as C
. In other words, the value at the rightmost side of the operator will be treated as the result value of the =
operation. The example mentioned above will be processed internally in the program as shown below:
B
← C
A
← B