OR INDEX

OR _ _ _ _ _ _ _ _ _ _ _ _ operator

The or binary logical operator returns true if either one or both of its arguments is true.

syntax:

<logical expression> or <logical expression>

<logical expression> must evaluate to true or nil.

examples:


a := 10; 

  A := 10 


if a<0 or a>140 then write "not a valid human age" else
   write "age = ",a;
 



  age = 10 


a := 200; 

  A := 200 


if a < 0 or a > 140 then write "not a valid human age";
			 


  not a valid human age

The or operator is left associative: x or y or z is equivalent to (x or y) or z.

Logical operators can only be used in conditional expressions, such as

if...then...else and while...do. or evaluates its arguments in order and quits, returning true, on finding the first true statement.