THE JOA LANGUAGE

Built-in Functions

Complete Joa built-in function reference, including print, range, conversions, math, input, assertions, and formatting.

These functions are available globally in every .jo program.


print(value, ...)

Prints one or more values to standard output, separated by spaces, followed by a newline.

print("Hello")               // Hello
print("Load:", 72, "%")      // Load: 72 %
print(192.168.1.1)           // 192.168.1.1

len(value)

Returns the length of a String (character count), List (element count), or Map (key count).

len("hello")         // 5
len([1, 2, 3])       // 3
len({a: 1, b: 2})    // 2

type(value)

Returns the type name of a value as a String.

type(42)             // "Integer"
type(3.14)           // "Float"
type("hi")           // "String"
type(true)           // "Bool"
type(null)           // "Null"
type([1, 2])         // "List"
type({})             // "Map"
type(10.0.0.0/8)     // "Subnet"
type(192.168.1.1)    // "IP"

str(value)

Converts any value to its String representation.

str(100)             // "100"
str(3.14)            // "3.14"
str(true)            // "true"
str(null)            // "null"
str(192.168.1.1)     // "192.168.1.1"

int(value)

Converts a Float or numeric String to an Integer.

int(3.9)             // 3  (truncates)
int("42")            // 42

float(value)

Converts an Integer or numeric String to a Float.

float(7)             // 7.0
float("3.14")        // 3.14

range(stop) / range(start, stop) / range(start, stop, step)

Generates a List of integers. Mirrors Python’s range().

range(5)             // [0, 1, 2, 3, 4]
range(2, 6)          // [2, 3, 4, 5]
range(0, 10, 2)      // [0, 2, 4, 6, 8]
range(5, 0, -1)      // [5, 4, 3, 2, 1]

abs(n)

Returns the absolute value of a number.

abs(-7)    // 7
abs(3.5)   // 3.5

max(a, b, ...) / min(a, b, ...)

Returns the largest or smallest value among the arguments.

max(3, 7, 2)   // 7
min(3, 7, 2)   // 2

sqrt(n)

Returns the square root of n as a Float.

sqrt(16)    // 4.0
sqrt(2)     // 1.4142135...

pow(base, exp)

Returns base ** exp as a Float.

pow(2, 10)   // 1024.0
pow(3, 3)    // 27.0

floor(n) / ceil(n) / round(n)

Standard rounding functions. floor and ceil return an Integer; round returns an Integer.

floor(3.9)   // 3
ceil(3.1)    // 4
round(3.5)   // 4
round(3.4)   // 3

input(prompt?)

Reads a line from standard input and returns it as a String. An optional prompt string is printed before reading.

let name = input("Enter your name: ")
print("Hello, " + name)

assert(condition, message?)

Asserts that condition is truthy. If it is not, a Runtime Error is raised with the optional message.

assert(1 + 1 == 2)
assert(len("hello") == 5, "String length is wrong")

// Failure:
assert(false, "This always fails")
// ❌ Runtime Error: This always fails

format(template, args...)

Returns a formatted string by replacing each {} placeholder with the corresponding argument (converted via str()).

let msg = format("Hello, {}! You are {} years old.", "Alice", 30)
print(msg)   // Hello, Alice! You are 30 years old.

let log = format("[{}] ERROR: {}", "2026-01-01", "Disk full")
print(log)   // [2026-01-01] ERROR: Disk full

Placeholders are filled left-to-right. Extra arguments are ignored; unmatched {} remain as-is.


quarantine(ip)

Prints a quarantine notice and returns true. This is a simulation; it does not isolate a host or change firewall rules.

quarantine(suspicious_ip)
// [SECURITY] Quarantining: 10.0.0.99

trigger_alert(location:)

Prints an alert notice and returns null. No external alert is sent. Named labels such as location: are accepted by the parser, but arguments are passed positionally; labels do not reorder arguments.

trigger_alert(location: "Server Room B")
// [ALERT] Server Room B