Logical Operators

And, And If Operators

Behavior: Evaluates two or more conditions, yielding true if both conditions are true, and false otherwise. Both the and and the and if operators will yield a logical value of true if and only if both of their operands are true. The and operator always fully evaluates both of its operands, while the and if operator only evaluates operand2 if operand1 is true. In the second example, the fullValidate() function will only be called if operation is equal to "test".

Parameters: Two or more conditions to test.

Syntax:

operand1 and operand2
operand1 and if operand2

Example:

if x > 7 and x < 12 then

Example:

if operation is "test" and if fullValidate(system) then

Or , Or If Operators

Behavior: Combines two conditions, yielding true if either one is true. Both the or and the or if operators will yield a logical value of true if either or both of their operands are true. The or operator always fully evaluates both of its operands, while the or if operator only evaluates operand2 if operand1 is false. In the second example, the search of file "N37" for "ruby" will only be performed if status is not equal to 99.

Syntax:

operand1 or operand2

operand1 or if operand2

Example:

if x < 7 or x > 12 then

Example:

if status = 99 or if file "N37" contains "ruby" then

Not Operator

Behavior: Obtains the opposite of a true or false condition.

Syntax:

not operand

Example:

if not showGreeting then ...

 

This topic was last updated on August 19, 2021, at 03:30:51 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant