User Tools

Site Tools


or

Table of Contents

or

or is a logical “inclusive or” operator

syntax

result = numeric-expression1 or numeric-expression2

See also and, nor, not, xor, eqv, imp

details

the or logical operator compares two expressions and returns the boolean value true if one of the expressions is true (non-zero). See the table below for possible results.

expression 1    expression 2    result
    true            true         true
    true            false        true
    false           true         true
    false           false        false

Logical operators are not to be confused with Bitwise Operators.

example

In this example a comparison is performed on two integer variables using an if-statement.

' SharpBASIC or programming example
' ---------------------------------
incl "lib/sys.sbi";

dim a, b: int;

main do
  a = 1;
  b = 0;
  if a or b do
    print(true);
  else do
    print(false);
  end
end
Output:

-1

or.txt · Last modified: 2023/06/26 10:42 by admin