logo Dorpn v0.4.1 GitHub
API Reference

Built-in Functions

The complete set of globally available functions in Dorpn — for I/O, type inspection, and math.

print(exp)

print(exp) Function

The print built-in is used to display output to the console. It is one of the most commonly used functions in the language and is typically the first step in learning how to interact with programs.

dorpn
# Single value
print("Hello")

# Multiple values (space-separated)
print("Value:", x, "Result:", result)

printOut(exp) v0.4.0+

printOut(exp) Function

Same as print, but writes output without a trailing newline. Useful for building output across multiple calls on a single line — progress indicators, prompts, or manually controlled formatting.

dorpn
printOut("Loading")
printOut(".")
printOut(".")
printOut(".")
print(" done")   # print() still adds the newline at the end
# Output: Loading... done
  • expOne or more values to write — same argument rules as print.

ask()

ask(prompt) Function

The ask built-in is used to receive input from the user during program execution. It pauses the program until the user provides a response, then returns that response as a String.

dorpn
# Without prompt
tag name = ask()

# With prompt
tag age = ask("Enter your age: ")

# Always returns String
tag input = ask("Say something: ")
print("You said:", input)
  • prompt(optional) A string message displayed to the user before waiting for input. If omitted, the program simply waits for input.
Strict prompt type (v0.4.1+)
ask() now requires its prompt argument to be a String. Passing an Int, Bool, or any other type raises a Semantic Error instead of silently compiling into broken C output.

type()

type(value) Function

The type built-in is used to determine the data type of a value or variable at runtime. It is especially useful when working with user input (from ask) or dynamic values, where the type may not be immediately obvious.

dorpn
print(type(42))      # "Int"
print(type(3.14))    # "Float"
print(type("text"))  # "String"
print(type(true))    # "Bool"

# Useful for debugging
tag value = 100
print("Type of value is:", type(value))

Mathematical Functions

abs()

abs(number) Math

Returns the absolute value of a number (an Int or Float). If the number is positive, it returns the same number; if negative, it returns its positive counterpart.

dorpn
tag a = abs(-10)      # 10
tag b = abs(-3.14)    # 3.14

min() / max()

min(...args) / max(...args) Math

min() compares all arguments and returns the smallest one. max() compares all arguments and returns the largest one. Works with Int, Float, and String (lexicographic comparison).

dorpn
tag small = min(5, 10)  # 5
tag large = max(5, 10)  # 10
print(min("apple", "banana")) # Output: apple

add()

add(...args) Math

Returns the sum of all given arguments — an alternative to using +. Adds all numeric arguments together and returns an Int or Float depending on the input.

dorpn
tag sum = add(7, 3)
print(sum)  # Output: 10

tag num = add(2, 3.0)
print(num)  # Output: 5.0

File I/O

Onload()

Onload(path) File I/O

Loads the provided resource at compile time and reads the content of a file as String from the given path.

dorpn
# Read entire file as string
tag content = Onload("data.txt")
print("File size:", content.size())

# Error if file doesn't exist
tag config = Onload("config.json")
Compile-time resolution
Onload() resolves its path at compile time, not runtime — the referenced file must exist when you compile, not just when you run the resulting executable.