This function returns whether a given variable is a real number (single, double or integer) or not. In some cases you want to check and see if a variable in GameMaker Studio 2 holds a real number, and that's when you would use this function. It does not return the real number but rather true or false, so a value of, for example, "fish" for n will return false, but a value of 200 for n will return true.
is_real(n);
| Argument | Description |
|---|---|
| n | The argument to check. |
Boolean
if is_real(val)
{
score += val;
}
The above code checks the variable "val" to see if it is a real number and if it is it then adds it to the score.