Input / Output Functions

print(value)

Output a value to stdout followed by a newline.

print("Hello, World!")
print(42)
print([1, 2, 3])

Returns null. Accepts any value.

input<str>(prompt)

Read a string from the user with an optional prompt.

set name = input("Enter name: ")
print(name)

Returns the input string without trailing newline.

input<int>(prompt)

Read an integer from the user with an optional prompt.

set age = input("Age: ")
print(age + 1)

Returns the input as a number. Errors if input is not numeric.

input<float>(prompt)

Read a decimal number from the user with an optional prompt.

set price = input("Price: ")
print(price * 1.1)

Returns the input as a floating-point number.

Type Checking

type(value)

Get the type of a value as a string.

print(type(42))
print(type("hello"))
print(type(true))
print(type(null))
print(type([1, 2, 3]))
print(type(#[1, 2]))
print(type({ x: 1 }))
print(type(fn(x) { return x }))

Returns one of: "number", "string", "boolean", "null", "array", "object", or "function".

Timing Functions

wait(milliseconds)

Pause execution for a specified number of milliseconds.

print("Starting pause...")
wait(500)
print("Done (half a second later)")

Useful for delays, animations, or rate-limiting. Returns null.

Example: Timed Loop

set i = 0
while (i < 3) {
    print(i)
    wait(200)
    set i = i + 1
}

Array Operations

push(array, value)

Add an element to the end of a mutable array.

set arr = [1, 2, 3]
push(arr, 4)
print(arr)

Modifies the array in place. Returns null.

pop(array)

Remove and return the last element of a mutable array.

set arr = [1, 2, 3]
set last = pop(arr)
print(last)
print(arr)

Returns the removed element. Returns null for empty arrays.

.length property

Get the number of elements in an array.

set arr = [10, 20, 30]
print(arr.length)

Works for both mutable and immutable arrays.

Object Operations

rmv(property)

Delete a property from an object.

set user = { name: "Kria", age: 5 }
rmv(user.name)
print(user.name)

After removal, the property returns null. Also works with bracket notation: rmv(user["name"]).

Comments & Strings

Single-line Comments

// This is a comment
set x = 10  // Inline comment

Everything after // on a line is ignored.

Block Comments

/*
  Multi-line comment
  spans multiple lines
*/
print("visible")

Nested block comments are not supported.

Multi-line Strings

print("""Line one
Line two
Line three""")

Use triple quotes """ for strings spanning multiple lines.