is_real

Returns whether the given argument is a real (as opposed to a string).

Syntax:

is_real(n);


Argument Description
n The argument to check.


Returns: Boolean


Description

This function returns whether a given variable is a real number or not. In some cases you want to check and see if a variable in GameMaker: Studio 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.


Example:

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.


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