Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Scroll pagebreak

Arithmetic operators

Anchor
Arith
Arith

Arithmetic operators

Arithmetic operators are symbols that represent mathematic functions.

...

Code Block
languagetext
// 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;
Anchor
Comparison

...

anchor
Comparison

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.

...

Code Block
languagetext
test condition ? operation1 : operation2
 int $markers = 5 < 9 ? 40 : 50; // Value: 40
Anchor
Logical

...

anchor
Logical

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.

...