Top

Name

boolean — Converts its argument to boolean

Synopsis

boolean boolean ( obj any );
 

Description

The function converts its argument to a boolean as follows:

  • A number is true if and only if it is neither zero nor NaN.

  • A node-set is true if and only if it is non-empty.

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

  • An object of a type other than the four basic types is converted to a boolean in a way that is dependent on that type.

Parameters

obj

The object to be converted into boolean.

Return Types

Boolean

Examples

Example 24.566. 

The following expressions are true:

boolean('aaa') = true()
boolean('false') = true()
boolean(false()) = false()
boolean(.) = true()
boolean('0') = true()
boolean(0) = false()