Logical Expressions

OQL provide three logical expressions which can take two form each. The logical or operator is || or or. The logical and operator is && or and. The logical not operator is ! or not.

The expression syntax, semantics, associativity and precedence are quite identical to the corresponding C and C++ expressions. Note that the ODMG operator ``||'' denotes the string concatenation.
As for C and C++, the OQL interpreter performs a lazy evaluation:
General Information
Operators ||
  &&
Type unary, binary
Syntaxes expr || expr
  expr or expr
  expr && expr
  expr and expr
  ! expr
  not expr
Operand Type boolean
Result Type boolean
Functions logical or
  logical and
  logical not

Expression Examples
expression result
true || false true
false || false false
true && false false
1 == 2 || 3 == 4 false
1 == 2 || 3 == 3 true
1 == 2 or 3 == 3 true
1 == 2 || "hello" == "hello" true
(1 == 2 || 2 == 2) && (a = "hello") returns true if a equals "hello". false otherwise
1 || 3 == 3 raises an error: boolean expected got integer
!3 raises an error: boolean expected got integer
!(1 == 1) false
not(1 == 1) false
EyeDB manual