Operators

The CueScript language allows for operators to be used in expressions. Operators are symbols that appear in-between two values that “operate” on those values. Common operators include mathematical functions such as + and for addition and subtraction, and boolean functions such as And, and Or.


Mathematical Operators

The following operators are mathematic, meaning that they perform functions on numbers:

Operator Function Example Result
+ Addition 3 + 5 8
Subtraction 5 – 3 2
* Multiplication 3 * 7 21
/ Division 18 / 3 6

Concatenation Operator

The following operator performs its function on strings. Shared with the Addition Operator, if either side of the “+” is a string, the result will be a string:

Operator Function Example Result
+ Concatenation “Cue” + “Server”
“CS” + 2
3 + “ is a crowd”
“CueServer”
“CS2”
“3 is a crowd”

Boolean Operators

The following operators are boolean, meaning that they compare two values in a true or false context. Note that the result of a boolean operator will always be either 0 (meaning false) or 1 (meaning true).

Operator Function Examples Result
== Equal 5 == 5
3 == 5
1
0
!= Not Equal 5 != 5
3 != 5
0
1
> Greater Than 5 > 3
3 > 5
1
0
>= Greater Than or Equal 5 >= 3
4 >= 4
2 >= 7
1
1
0
< Less Than 3 < 5
5 < 3
1
0
<= Less Than or Equal 3 <= 5
4 <= 4
7 <= 2
1
1
0
and Logical And 0 and 0
0 and 1
1 and 0
1 and 1
0
0
0
1
or Logical Or 0 or 0
0 or 1
1 or 0
1 or 1
0
1
1
1