Skip to content

Type Functions

Type checking and conversion.

Type Checking

typeof(value)

Get type as string.

print typeof(42);          // number
print typeof("hello");     // string
print typeof(true);        // bool
print typeof([1, 2, 3]);   // array
print typeof(|x|=>{});     // lambda

Type Conversion

int(value)

Convert to integer.

print int("42");    // 42
print int("3.7");   // 3
print int(3.9);     // 3
print int("hello"); // Error

float(value)

Convert to float.

print float("3.14");  // 3.14
print float("42");    // 42.0
print float(100);     // 100.0

str(value)

Convert to string (see String Functions).