Main Index : Reference :
[int] typeof([any type] object)
object
is any object or variable.
typeof()
returns the type of object
as an integer. This value can be interpreted with the following enumerated constants:
Constant | Label | Explanation | |
Common | DT_NIL |
[nil] |
nil |
DT_LONG |
[int] |
integer | |
DT_FLOAT |
[float] |
floating point | |
N/A |
[bool] |
boolean (either TRUE or FALSE ) |
|
DT_VECTOR |
[vector] |
vector | |
DT_VOID |
[void] |
void pointer (C/C++) | |
DT_BYTES |
[bytes] |
byte array | |
DT_STRING |
[string] |
string | |
DT_CLASS |
[class] |
class | |
DT_OBJECT |
[object] |
object | |
DT_ARRAY |
[array] |
array | |
Executable | DT_BYTECODE |
[bytecode] |
C.O.F.F.E.E. bytecode |
DT_CODE |
[code] |
internal C/C++ code | |
DT_EXTCODE |
[extcode] |
external C/C++ code | |
Other | DT_EXCEPTION |
[exception] |
catchable exception |
DT_SEXCEPTION |
[sexception] |
system exception | |
DT_INSTANCE |
[instance] |
C.O.F.F.E.E. instance |
Click on the labels for more information about specific types.
// Outputs "5.500000 is a float.".
int_or_float(x)
{
switch(typeof(x))
{
case DT_INT:
return "an integer";
case DT_FLOAT:
return "a float";
default:
return "unknown";
}
}
var x = 5.5;
println(x," is ",int_or_float(x),".");