Reference
Appendix A: Complete Built-in Reference (QF Code 1.1.0)
Every built-in function in QF Code 1.1.0, organized by purpose. Each entry has been traced against the actual 1.1.0 shell behavior, not written from the language specification alone. Written lowercase throughout, matching this book's style; QF Code itself is case-insensitive.
Output and Input
write(value, ...): Prints one or more values, space-joined, without
starting a new line. A later write() or writeln() continues on the
same line. Chapter 1.
write("A")
write("B") // still on the same line as "A"writeln(value, ...): Prints one or more values, space-joined, and
always completes its own line, even if a write() left a line open.
Chapter 1.
writeln("Hello, adventurer.")input(prompt): Requires a string prompt. Pauses the program until the player types something and presses Enter. Always returns a string, even if the player types a number. Chapter 2.
var name = input("What is your name? ")Program Control
erase(): With no argument, clears the output panel. Chapter 1 (mentioned), used directly if you want to clear the screen.
erase(array): Removes every item from the given array, in place. Chapter 5.
stop(): Intended to halt the whole program immediately. Worth
knowing as of 1.1.0: a standalone stop() line at the top level or
inside a function doesn't currently behave as cleanly as calling it from
inside an expression does. If you need reliable early termination, a
return from a function or a loop's break is the more dependable tool
for now.
signal(message): Raises a runtime error with the message you give
it, the kind of error an attempt block can catch. Chapter 10.
Sound
sound(pitch, duration_ms): Plays a tone. pitch can be a frequency
in hertz, or a note name like "C4", "A#3", or "Bb5". Blocks the
program until the tone finishes. Chapter 12.
sound("C4", 150)bell(): Plays a short, fixed tone (880 Hz for 150 ms), no arguments. Also blocks until it finishes. Chapter 12.
Type Conversion
str(value): Converts any value to its display text form, the same
form writeln() would print. Chapter 2.
str(true) // "TRUE"
str(empty) // "EMPTY"num(value): Converts a value to a number. Numbers pass through
unchanged, true/false become 1/0, and strings are converted the
same way JavaScript's Number() would. A string that can't become a
valid number raises an error. Chapter 2.
num("4") // 4
num("") // 0bool(value): Converts certain values to a boolean. Accepts true,
1, "true", and "TRUE" as true; false, 0, "false", "FALSE",
and empty as false. Anything else raises an error, and mixed-case
strings like "True" are not accepted. Chapter 2.
Type Checking
isnumber(value): true if the value is a number.
isstring(value): true if the value is a string.
isbool(value): true if the value is a boolean.
isempty(value): true if the value is empty.
isarray(value): true if the value is an array.
Shared by Strings and Arrays
length(value): Returns the number of characters in a string, or the number of items in an array. Chapters 5 and 7.
contains(collection, value): For a string, checks whether it contains another string, case-sensitively. For an array, checks whether any item equals the given value. Chapter 7.
String Functions
upper(string): Converts a string to uppercase. Chapter 7.
lower(string): Converts a string to lowercase. Chapter 7.
lower("PIANO") // "piano"trim(string): Removes whitespace from the start and end of a string, leaving the middle untouched. Chapter 7.
replace(string, old, new): Replaces every occurrence of old with
new. Chapter 7.
split(string, delimiter): Breaks a string into an array of pieces, wherever the delimiter appears. Chapter 7.
split("take candle", " ") // ["take", "candle"]substring(string, start, length): Returns part of a string,
starting at position start for length characters.
startswith(string, prefix): true if the string begins with
prefix, case-sensitively. Chapter 7.
endswith(string, suffix): true if the string ends with suffix,
case-sensitively. Chapter 7.
Math Functions
abs(number): Absolute value, strips a negative sign. Chapter 8.
pow(base, exponent): Raises base to the power of exponent.
Chapter 8.
round(number): Rounds to the nearest whole number. Chapter 8.
floor(number): Always rounds down. Chapter 8.
ceiling(number): Always rounds up. Chapter 8.
sqrt(number): Square root. A negative input raises an error. Chapter 8.
min(a, b): Returns the smaller of two numbers. Chapter 8.
max(a, b): Returns the larger of two numbers. Chapter 8.
random(): Returns a random number from 0 up to, but not
including, 1. Chapter 8.
randomint(min, max): Returns a random whole number, inclusive of
both min and max. Both must be whole numbers. Chapter 8.
randomint(1, 100)Array Functions
array(): Creates a new, empty array. Chapter 5.
array(size): Creates a new array with size slots, each filled
with empty. size must be a whole number, zero or greater.
append(array, value): Adds value to the end of the array, in
place. Chapter 5.
remove(array, index): Removes the item at index, in place.
index must point to an existing item. Chapter 5.
insert(array, index, value): Inserts value at index, in place.
index may be anywhere from 0 up to and including the array's current
length. Chapter 5.
reverse(array): Reverses the array in place, and also returns it.
sort(array): Sorts the array in place, and also returns it.
Special Object
last_error: Always available, holds three properties about the
most recently caught error: last_error.message (the error text),
last_error.line (the source line), and last_error.code (a short
category code). Resets before each ordinary statement; populated when an
attempt block catches an error. In most cases, naming a variable after
error in an attempt block is simpler and does the same job. Chapter
10.
Copyright © 2026 Edison Mooers. Published by Gibidda Press. Free for personal learning and qualifying noncommercial educational use. Commercial training, organizational use, redistribution, and adaptation require written permission. Full use terms.