bool

This function will attempt to convert a given value into a boolean data type, where the value will be returned as true if it is greater than 0.5, and false otherwise.

 

Syntax:

bool(n);

Argument Type Description
n Real The value to convert.

 

Returns:

Boolean

 

Example:

if !is_bool(val)
{
    val = bool(val);
}

The above code checks the variable "val" to see if it is a boolean and if it is not then it is converted to one.