or

Syntax expression1 or expression2

expression1 || expression2

Action The logical disjunction (boolean "or") operator, yields the boolean value true if either expression1 or expression2 evaluates to true, false otherwise.

Examples file.exists ("myFile") or !file.exists ("myFile")

   » true

This expression always evaluates to true, because it is impossible for both expressions to be false at the same time.

file.isFolder ("myFile") or (file.type ("myFile") != 'TEXT')

   » true

This expression evaluates to true if "myFile" is a folder, or is not a text file.

Notes There is no difference between the two forms, || and or.

UserTalk employs "short-circuit" evaluation of boolean expressions. That means that if expression1 of an or operation evaluates to true, expression2 will not be evaluated, since it can already be determined that the result of the operation will be true.

So in example #2 above, the call to file.type will never be made if file.isFolder returns true.

See Also and

not

Discuss