All help topics · Link to this topic
Showing help on 'typeof()'
Syntax: typeof (value) => INTTakes any MOO value and returns an integer representing the type of value.
The result is the same as the initial value of one of these built-in variables: INT, FLOAT, STR, LIST, MAP, OBJ, or ERR, BOOL, MAP, WAIF, ANON.
Thus, one usually writes code like this:
if (typeof(x) == LIST) ...
and not like this:
if (typeof(x) == 3) ...
because the former is much more readable than the latter.