Windows Interface Language operators take one operand ("unary operators") or two operands ("binary operators"). |
§ Precedence and evaluation order § Step by step guide to learning WIL § Notes
|
Unary operators (integers and floating point numbers)
- |
Arithmetic Negation (Two's complement) |
+ |
Identity (Unary plus) |
Unary operators (integers only)
~ |
Bitwise Not. Changes each 0 bit to 1, and vice-versa. |
! |
Logical Not. Produces 0 (@FALSE) if the operand is nonzero, else 1(@TRUE) if the operand is zero. |
Unary operators (variable reference)
& |
Creates a pointer. |
* |
References variable via a pointer. |
Binary logical operators (integers only)
<< |
Left Shift |
>> |
Right Shift |
& |
Bitwise And |
| |
Bitwise Or |
^ |
Bitwise Exclusive Or (XOR) |
&& |
Logical And |
|| |
Logical Or |
; If statement using Logical AND operator
If x>0 && x<=10
Pause( 'Result', x : ' is between 1 and 10' )
Else
Pause( 'Result', x : ' is NOT between 1 and 10' )
EndIf
Binary arithmetic operators (integers and floating point numbers)
** |
Exponentiation |
* |
Multiplication |
/ |
Division |
Modulo |
|
+ |
Addition |
- |
Subtraction |
|
|
Binary string operators
: |
Concatenation |
Binary relational operators
> |
Greater-than |
>= |
Greater-than or equal |
< |
Less-than |
<= |
Less-than or equal |
== |
Equality |
!= or <> |
Inequality |
When a string comparison is made, the lengths of the strings are ignored. Instead, the comparison begins with the first character of each string. If the first characters of each match, the next characters of each are compared, continuing until a mismatch is found. The rules for string matches made using the Binary Relational Operators are:
If every character matches exactly and the strings are the same length, the strings are reported as identical.
If every character matches until the last character of one string is reached but the other string has remaining characters, the longer string will be reported as larger.
If the mismatch is between two numeric characters, the string with the larger numeric character is reported as larger.
When two case-mismatched alphabetic characters are found—one uppercase and one lowercase—the string with the uppercase character is reported as larger (even though the ASCII character code for A is 65, or 41h, while the character code for a is 97, or 61h).
For mismatched nonalphabetic and nonnumeric characters, the ASCII character codes are used. Following the rules for alphabetic characters, the string with the lower character code is reported as the larger string. For example, "one apple#" is reported as less than "one apple$" because the character code for # is 35 (23h), one less than the character code for $ (36 or 24h).
Assignment operator
= |
Assigns evaluated result of an expression to a variable. |
Binary compound assignment operators
Operator |
Example |
Equivalent |
Description |
<<= |
x <<= y |
x = x << y |
Left Shift with Assignment. |
>>= |
x >>= y |
x = x >> y |
Right Shift with Assignment. |
&= |
x &= y |
x = x & y |
Bitwise AND with Assignment. |
|= |
x |= y |
x = x | y |
Bitwise OR with Assignment. |
^= |
x ^= y |
x = x ^ y |
Bitwise Exclusive OR with Assignment. |
*= |
x *= y |
x = x * y |
Multiplication with Assignment. |
/= |
x /= y |
x = x / y |
Division with Assignment. |
+= |
x += y |
x = x + y |
Addition with Assignment. |
-= |
x -= y |
x = x - y |
Subtraction with Assignment. |
:= |
x := y |
x = x : y |
String Concatenation with Assignment. |
mod= |
x mod= y |
x = x mod y |
Modulo with Assignment. |