2. Logical functions

2.1. and

and(boolean1, boolean2+)

Returns the logical AND of its arguments (after converting them to booleans, if needed to).

  • A number is TRUE if and only if it is neither positive or negative zero nor NaN.

  • A string is TRUE if and only if its length is non-zero.

  • A date/time is always TRUE.

  • An XML nodeset is TRUE if and only if it is non-empty.

See also or, not.

2.2. or

or(boolean1, boolean2+)

Returns the logical OR of its arguments (after converting them to booleans, if needed to).

Conversion of values to booleans is described here.

See also and, not.

2.3. not

not(boolean)

Returns TRUE if its argument is FALSE, and FALSE otherwise.

Conversion of values to booleans is described here.

See also and, or.

2.4. if

if(test1, value1, alternative*, fallback)

Alternative is: testi valuei.

Evaluates each testi in turn as a boolean, if the result of testi is TRUE, returns corresponding valuei. Otherwise, if all testi evaluates to FALSE, returns fallback.

Conversion of values to booleans is described here.

See also and, or, not.

2.5. true

true()

Returns TRUE. Note that it is also possible to write TRUE instead of TRUE().

2.6. false

false()

Returns FALSE. Note that it is also possible to write FALSE instead of FALSE().