BOOLEAN

The BOOLEAN function returns a result equal to Expression converted to boolean.

Notes

Example

a = [0.0, 1.0, 0.0, 3.0]

b = BOOLEAN(a)

b[2] = "yes" ; equal to "true"

HELP, b

PRINT, b

PRINT, JSON_SERIALIZE(b)

IDL prints:

B  BOOLEAN = Array[4]

0  1  1  1

[false,true,true,true]

Syntax

Result = BOOLEAN( Expression )

Return Value

Returns a boolean value or array of the same dimensions as the Expression. The following rules are used for conversion:

Arguments

Expression

The expression to be converted to boolean. Expression can be any data type except structure.

Keywords

Thread Pool Keywords

This routine is written to make use of IDL’s thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the !CPU system variable control whether IDL uses the thread pool for a given computation. In addition, you can use the thread pool keywords TPOOL_MAX_ELTS, TPOOL_MIN_ELTS, and TPOOL_NOTHREAD to override the defaults established by !CPU for a single invocation of this routine. See Thread Pool Keywords for details.

Version History

8.4

Introduced

See Also

BOOLARR, BYTE, COMPLEX, DCOMPLEX, DOUBLE, FIX, FLOAT, LONG, LONG64, STRING, UINT, ULONG, ULONG64