Validity: Rule, Task
These operators operate between binary boolean quantities and returns a result of binary boolean type, that is, a result that can have only two values: "true" or "false".
AND logical
Logical conjunction between boolean expressions.
Syntax |
valueA and valueB |
|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
valueA |
First boolean value |
|||||||||||||||
valueB |
Second boolean value |
|||||||||||||||
Result |
|
Examples:
; If the contents of register rr(12) is zero and input(5) is active (i.e., non-zero) ; then the string register sr(1) will be assigned the string: ; "the variable rr(12) is equal to zero and input 5 is TRUE" _if ((rr(12) = 0) and inp(5)) sr(1) = "the variable rr(12) is equal to zero and input 5 is TRUE" ; If the contents of registers r(12) and r(5) are non-zero ; then the string register sr(1) will be assigned the string: ; "both registers r(12) and r(5) are different from zero." _if (r(12) and r(5)) sr(1) = "Both register r(12) and r(5) are different from zero" |
NOT logical
Logical negation operator of a boolean expression.
Syntax |
not value |
||||||
---|---|---|---|---|---|---|---|
value |
Boolean value |
||||||
Result |
|
Examples:
; If it is false that the value of the variable "value1" ; is equal to the contents of register r(5) ; then the string register sr(3) will be assigned the string: ; "the variable value1 is different from the contents of r(5)" if (not (value1 = r(5)) sr(3)= "the variable value1 is different from the contents of r(5)" endif |
OR logical
Logical disjunction between boolean expressions.
Syntax |
valueA or valueB |
|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
valueA |
First boolean value |
|||||||||||||||
valueB |
Second boolean value |
|||||||||||||||
Result |
|
Examples:
; if the value of the variable "value1" is non-zero ; or input(5) is active (i.e. different from zero) ; then the string register sr(3) will be assigned the string: ; "variable value1 is <> 0 or input 5 is TRUE" if (value1 or inp(5)) sr(3) = "the variable value1 is <> 0 or input 5 is TRUE" endif |
XOR logical
Exclusive logical disjunction between boolean expressions.
Syntax |
valueA xor valueB |
|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
valueA |
First boolean value |
|||||||||||||||
valueB |
Second boolean value |
|||||||||||||||
Result |
|
Examples:
; If inp(1) and inp(2) are both true or both false ; then the boolean variable returns will be assigned the value false ; if one of the two inputs is true and the other is false ; then the boolean variable returns will be assigned the value true returns = xor(inp(1), inp(2))
; if only one of the two inputs is true and the other is false ; then the contents of register r(1) will be incremented by one unit if (xor(inp(1), inp(2))) inc(r(1) ,1) endif |