BOOL()

BOOL()

Top  Previous  Next

 

The BOOL() function converts a value to Boolean form.

 

 

Format

 

BOOL(expr)

 

where

 

expris the value to be converted. This must be a numeric value or a string.

 

 

The BOOL() function returns False if expr is zero or a null string, True for all other values.

 

This function is rarely needed because all QMBasic operations requiring a Boolean value perform the conversion automatically. It might be useful, for example, when constructing a data collection that will be converted to JSON using the JBUILD() function as JSON differentiates Boolean and numeric values.

 

 

Example

 

N = BOOL(X)

 

This statement converts X to Boolean form using the rules described above.

 

 
See also:

INT(), NUMERIC(), STR()