is_bool

Returns whether the given argument is a boolean value.

Syntax:

is_bool(n);


Argument Description
n The argument to check.


Returns: Boolean


Description

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 Studio 2 holds a boolean value, and that's when you would use this function.


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.


Back: Data Types
Next: is_array
© Copyright YoYo Games Ltd. 2018 All Rights Reserved