operator or (operand1, operand2: Boolean) = Result: Boolean;
or
operator or (operand1, operand2: integer_type) = Result: integer_type;
or
procedure or (var operand1: integer_type; operand2: integer_type);
In GNU Pascal, or has three built-in meanings:
By default, or acts as a short-circuit operator in GPC: If the first operand is True, the second operand is not evaluated because the result is already known to be True. You can change this to complete evaluation using the --no-short-circuit command-line option or the {$B+} compiler directive.
The logical or operator is defined in ISO 7185 Pascal.
According to ISO, you cannot rely on or being a short-circuit operator. On the other hand, GPC's default behaviour does not contradict the ISO standard. (See or_else.) However, since it seems to be a de-facto standard among ISO Pascal compilers to evaluate both operands of or, GPC switches to --no-short-circuit mode if one of the language dialect options selecting ISO Pascal, for instance --extended-pascal, is given. Use --short-circuit to override.
Use of or as a bitwise operator for integers is a Borland Pascal extension.
Use of or as a “procedure” is a GNU Pascal extension.
program OrDemo; var a, b, c: Integer; begin if (a = 0) or (b = 0) then { logical `or' } c := 1 else if (a or b) = 0 then { bitwise `or' } c := 2 else or (c, a) { same as `c := c or a' } end.
Note the difference between the logical or and the bitwise or: When a is 2 and b is 4, then a or b is 6. Beware: a or b = 0 happens to mean the same as (a = 0) and (b = 0). (Note the and!)
Since bitwise or has a higher priority than the = operator, parentheses are needed in if (a = 0) or (b = 0) because otherwise 0 or b would be calculated first, and the remainder would cause a parse error.