Scripting/GML-Overview/bool

Last-modified: 2018-12-21 (金) 18:55:01

bool

 

Description
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);
 

Arguments:

ArgumentDescription
nThe 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.