The operators +, -, *, /, ^, %, and \ are used to perform addition, subtraction, multiplication, division, exponentiation, modulo, and integer division of their operands, respectively. Valid operands are numeric constants and/or numeric variables.
The = operator is used both for assignment to variables, and to test for equality. The + operator may be used to perform concatenation of any combination of string constants and string variables. The : operator can separate multiple statements on a single line. The ; operator suppresses the new line that is printed from a PRINT statement. The # operator is a shortcut for the Rem statement, and is interchangeable with it.
Order of Operations | ||
---|---|---|
Level | Operators | Category/Description |
1 | ( ) | Grouping |
2 | ^ | Exponent |
3 | - | Unary Minus |
4 | * / \ | Multiplication and Division |
5 | % | Integer Remainder (Mod) |
6 | + - | Addition, Concatenation, and Subtraction |
7 | < ⇐ > >= = <> | Comparison (Numeric and String) |
8 | NOT | Unary Not |
9 | AND | Logical And |
10 | OR | Logical Or |
11 | XOR | Logical Exclusive Or |