Feedback

  • Contents
 

Comparison Operators

The following operators compare two values and return a Boolean value (true or false.) Some of these operators will compare alpha-numeric characters. For these operators, comparisons are made alphabetically. For example, "a" is less than "c" because a appears in the alphabet before c. Also, all lower-case letters are less than upper-case letters. For example upper-case "A" is greater than lower-case "z".

=

(ANY_SIMPLE_TYPE) = (ANY_SIMPLE_TYPE)

The value on the left equals the value on the right, this operator will result in a value of true.

Example: In the expression 5=5, the result would be true because both values are equal.

In the expression "Fred"="Barny", the result would be false because the string "Fred" does not equal the string "Barny".

>

(ANY_SIMPLE_TYPE) > (ANY_SIMPLE_TYPE)

If the value on the left is greater than the value on the right, this operator will result in a value of true.

Example: In the expression (10>1), the result would be true because ten is greater than one.

In the expression (4>5), the result would be false because four is not greater than five.

>=

(ANY_SIMPLE_TYPE) >= (ANY_SIMPLE_TYPE)

If the value on the left is greater than or equal to the value on the right, this operator will result in a value of true.

Example: In the expression (10>=1), the result would be true because ten is greater than one.

In the expression (1>=1), the result would be true because one is equal to one.

In the expression (4>=5), the result would be false because four is not greater than or equal to five.

<

(ANY_SIMPLE_TYPE) > (ANY_SIMPLE_TYPE)

If the value on the left is less than the value on the right, this operator will result in a value of true.

Example: In the expression (1<10), the result would be true because one is less than ten.

In the expression (5<4), the result would be false because five is not less than four.

<=

(ANY_SIMPLE_TYPE) >= (ANY_SIMPLE_TYPE)

If the value on the left is less than or equal to the value on the right, this operator will result in a value of true.

Example: In the expression (1<=10), the result would be true because one is less than ten.

In the expression (1<=1), the result would be true because one is equal to one.

In the expression (5<=4), the result would be false because five is not less than or equal to five.

<>

(ANY_SIMPLE_TYPE) <> (ANY_SIMPLE_TYPE)

If the value on the left is not equal to the value on the right, this operator will result in a value of true.

Example: In the expression (1<>10), the result would be true because one is not equal to ten.

In the expression (1<>1), the result would be false because one is equal to one.

Not

Not (Boolean)

Reverses the value of a Boolean expression.

Example: If the value is (4<3) is false, the value of Not(4<3) is true.
If the value is (1<2) is true, the value of Not(1<2) is false.

And

(Boolean) And (Boolean)

 output( BOOLEAN ) 

If the value of both operands is true, this operator will result in a value of true.

Example: In the expression (4<5) And (5<6), the result would be true because both values are true.

In the expression (4<5) And (8<7), the result would be false because at least one value is false.

In the expression (10<9) And (2<1), the result would be false because at least one value is false.

Or

(Boolean) Or (Boolean) 

If the value of either operand is true, this operator will result in a value of true.

Example: In the expression (4<5) Or (6<5), the result would be true because at least one value is true.

In the expression (4<5) Or (7<8), the result would be true because at least one value is true.

In the expression (10<9) Or (2<1), the result would be false because neither value is true.

InStr

InStr (String, String)

If the value of the first string is found in the value of the second string, this operator will result in a value of true. The string comparison is case sensitive. To make the comparison case insensitive, use the StrLower() operator or StrUpper() operator with both strings.

Example: InStr ("Dog", "Dogs") would be true because the first string can be found in the second string.

InStr ("Cat", "Carbine") would be false because the first string cannot be found in the second string.

InStr("y","XyZ") would be true because the first string can be found in the second string.

InStr("y","xYz") would be false because the first string contains a lowercase y and the second string contains an uppercase Y.