...
For example:
int $frame = 1;
where:
int $frame | is the left side operand, in this case a variable. |
= | is the operator, in this case an assignment operator |
1; | is the right side operator, in this case the value assigned to the variable |
The following sections show you how to work with operators:
Scroll only |
---|
scroll-viewport | true |
---|
scroll-pdf | true |
---|
scroll-office | true |
---|
scroll-chm | true |
---|
scroll- |
---|
|
...
...
...
...
Understand operator types
...
Arithmetic operators
Arithmetic operators are symbols that represent mathematic functions.
...
Both statements accomplish the same results.
Arithmetic operator examples
...
- Vectors
The power (^) operator calculates the cross product of vectors, and the multiplication * operator calculates the dot product of vectors. For all other operators, each component of one vector is operated on by its counterpart component in the other vector.
//Value: -4.000000, 2.000000, 0.000000
vector $test = <<1, 2, 3>> ^ <<2, 4, 4>>;
print ($test);
Operator shortcut examples
...
Code Block |
---|
|
// Declare variable
int $inside = 1;
// Shortcut for expression $inside = $inside + 9
$inside += 9;
// Shortcut for expression $inside = $inside –2
$inside -= 2;
// Shortcut for expression $inside = $inside 10
$inside *= 10;
print $inside;
//declare variable
vector $outside = <<2,2,2>>;
// Shortcut for expression $outside += $outside + <<<<1,2,3>>
$outside += <<1,2,3>>;
print $outside; |
Comparison operators
Comparison operators are used to compare two values and evaluate whether a statement is true based on the relation of the value on the left to the value on the right and then execute the statement accordingly.
...
You can write a hook statement with a comparison operator using three operands.
Examples of comparison expressions
...
Code Block |
---|
|
test condition ? operation1 : operation2
int $markers = 5 < 9 ? 40 : 50; // Value: 40 |
Logical operators
Logical operators are used to compare two values and evaluate whether a statement is true or false and then execute the statement accordingly. Logical operators create boolean results, that is, values of either TRUE or FALSE.
...
Code Block |
---|
|
( ) [ ]
*/ % ^
+ -
< <= > >=
== !=
&&
||
?:
= += -= *= /= |
Lowest precedence
Examples of when precedence effects the value of a statement:
Code Block |
---|
|
//$front = (5 +(2*3))
int $front = 5 + 2 3
//$side = $side ((8 % 5) / 3)
int $back = 2 - 3 int (1 < 3);
//$side = $side ((8 % 5) / 3)
int $side = 2;
$side = 8 % 5 / 3; |
...
Grouping operations for precedence
...