Validity: Rule, Task
These operators operate on numerical quantities. Use on quantities of logical type should be avoided while comparing strings requires the use of the appropriate functions.
Minor operator
Syntax |
valueA < valueB |
---|---|
valueA |
First value |
valueB |
Second value |
Result |
True if valueA less than valueB, false otherwise |
Examples:
; If the contents of register r(2) is less than the contents of register rr(3) ; then the following "if" instructions will be executed if (r(2) < rr(3)) endif
; If the condition is false (i.e., the contents of register nvr(1) ; is not less than the contents of register nvr(2)) ; then "return" will be assigned the value 0 (return = 0). ; If the condition is true (i.e., the contents of the register nvr(1) ; is less than the contents of register nvr(2)) ; then "return" will be assigned the value 1 (return = 1) return = (nvr(1) < nvr(2)) |
Operator less than or equal to
Syntax |
valueA <= valueB |
---|---|
valueA |
First value |
valueB |
Second value |
Result |
True if valueA less than or equal to valueB, false otherwise |
Examples:
; if the variable "value1" is less than or equal to 3.1415 ; then the following "if" statements will be executed if (value1 <= 3.1415) ... endif
; If the condition is false (that is, the contents of register nvr(1) ; is not less than or equal to the contents of register nvr(2)) ; then "return" will be assigned the value 0 (return = 0). ; If the condition is true (i.e., the contents of register nvr(1) ; is less than or equal to the contents of register nvr(2)) ; then "return" will be assigned the value 1 (return = 1) return =(nvr(1) <= nvr(2)) |
Major operator
Syntax |
valueA > valueB |
---|---|
valueA |
First value |
valueB |
Second value |
Result |
True if valueA greater than valueB, false otherwise |
Examples:
; if the contents of register rr(2) is greater than the contents of register r(3) ; then the following "if" statements will be executed if (rr(2) > r(3)) ... endif
; If the condition is false (that is, the contents of register nvr(1) ; is not greater than the contents of register nvr(2)) ; then "return" will be assigned the value 0 (return = 0). ; If the condition is true (i.e., the contents of register nvr(1) ; is greater than the contents of register nvr(2)) ; then "return" will be assigned the value 1 (return = 1) return = (nvr(1) > nvr(2)) |
Operator greater than or equal to
Syntax |
valueA >= valueB |
---|---|
valueA |
First value |
valueB |
Second value |
Result |
True if valueA greater than or equal to valueB, false otherwise |
Examples:
; If the variable "value1" is greater than or equal to 3.1415 ; then the following "if" statements will be executed if (value1 >= 3.1415) ...
; If the condition is false (that is, the contents of register nvr(1) ; is not greater than or equal to the contents of register nvr(2)) ; then "return" will be assigned the value 0 (return = 0). ; If the condition is true (that is, the contents of register nvr(1) ; is greater than or equal to the contents of register nvr(2)) ; then "return" will be assigned the value 1 (return = 1) return =(nvr(1) >= nvr(2)) |
Equality operator
Syntax |
valueA = valueB |
---|---|
valueA |
First value |
valueB |
Second value |
Result |
True if valueA equals valueB, false otherwise |
Examples:
; If the contents of register r(2) is equal to the variable "value1" ; then the following "if" statements will be executed if (r(2) = value1) ... endif
; If the contents of register rr(2) is equal to the variable "value2" using ; the similar() function, then the following instructions at the "if" will be executed if(similar(rr(2), value1) ... endif
; If the condition is false (that is, the contents of register nvr(1) ; is not equal to the contents of register nvr(2)) ; then "return" will be assigned the value 0 (return = 0). ; If the condition is true (i.e., the contents of register nvr(1) ; is equal to the contents of register nvr(2)) ; then "return" will be assigned the value 1 (return = 1) return = (nvr(1) = nvr(2)) |
NOTE: We do not recommend using the = operator to compare real quantities (or a real with an integer): instead, we recommend using the appropriate similar() function.
Not equality operator
Syntax |
valueA <> valueB |
---|---|
valueA |
First value |
valueB |
Second value |
Result |
True if valueA different from valueB, false otherwise |
Examples:
; if the variable "value" is different from 3.1415 ; then the following "if" statements will be executed. if (value1 <> 3.1415 ) ... endif
; If the condition is false (that is, the contents of register nvr(1) ; is not different from the contents of register nvr(2)) ; then "return" will be assigned the value 0 (return = 0). ; If the condition is true (i.e., the contents of register nvr(1) ; is different from the contents of register nvr(2)) ; then "return" will be assigned the value 1 (return = 1) return = (nvr(1) <> nvr(2)) |