is_bool

This function returns whether a given variable is a boolean (true ior false) or not. In some cases you want to check and see if a variable in GameMaker holds a boolean value, and that's when you would use this function.

 

Syntax:

is_bool(n);

ArgumentTypeDescription
nAnyThe argument to check.

 

Returns:

Boolean

 

Example:

if (is_bool(val))
{
    global.Sound = val;
}
else
{
    global.Sound = true;
}

The above code checks the variable "val" to see if it is a real number and if it is it then uses it to set a global variable.