×
Menu
Index

Operators

 
Operators are used in expressions to modify or compare subexpressions. TBScript supports arbitrarily complex expressions and all of the following operators.
 
Unary operators:
+
-
Positive (the default)
Negative
Assignment operator:
=
Assigns a value to a variable
Concatenation operator:
#
Appends one string to another
Math operators:
+
-
*
/
%
Adds one value to another
Subtracts one value from another
Multiplies one value by another
Divides one value by another
Divides one value by another and returns the remainder
Bitwise operators:
&
|
^
Bitwise AND
Bitwise OR
Bitwise XOR
Comparison operators:
=
<>
<
>
<=
>=
Equal
Not equal
Less than
Greater then
Less than or equal
Greater than or equal
Logical operators:
AND
OR
If both expressions are true
If either expression is true
 
NOTE: The concatenation, addition, subtraction, and bitwise operators all operate at the same precedence from left to right. (e.g. "Answer is:" # 3 & 3 results in 0, "Answer is:" # (3 & 3) results in "Answer is:3")
 
Here are some examples:
sub main()
   // Print ASCII value of "A"
   printl(ASC("A"))
end sub