Reference
Appendix E: QF Code at a Glance
A quick reminder of how to write something, not an explanation of why. For the full explanation, see the chapter listed, or Appendix A for every built-in in detail.
Comments
// a comment, skipped entirelyVariables and Constants
var name = "Alice" // can change later
const maxAttempts = 3 // cannot be reassignedThe Three Common Value Kinds
var score = 0 // number
var name = "Alice" // string
var isReady = true // boolean (true / false)Input and Output
write("A") // no new line after
writeln("Hello.") // completes its own line
var answer = input("Prompt: ") // always returns a stringComparison Operators
== != < > <= >=Logical Operators
and or xor notType Conversion
str(value) // to text
num(value) // to number
bool(value) // to booleanif / else if / else
if condition then
statements
else if other_condition then
statements
else
statements
end ifwhile
while condition
statements
end whilefor (counted)
for i = 1 to 5
statements
end for
for i = 10 to 1 step -1
statements
end forfor each
for each item in collection
statements
end forbreak and continue
break // exit the loop now
continue // skip to the next iterationmatch
match subject
when value
statements
when other_value
when another_value
statements
when 1 to 10
statements
when else
statements
end matchFunctions
function name(parameter1, parameter2)
statements
return value
end function
name(argument1, argument2)Arrays
var items = ["a", "b", "c"] // literal
var items = array() // empty
var items = array(10) // pre-sized, filled with empty
items[0] // read, zero-based
items[0] = "z" // assign
append(items, "d")
insert(items, 0, "first")
remove(items, 2)
length(items)
contains(items, "a")
reverse(items)
sort(items)
erase(items)Error Handling
attempt
statements
error message
handler_statements
end attempt
signal("custom error message")last_error.message
last_error.line
last_error.codeString Functions
upper(s) lower(s) trim(s)
replace(s, old, new)
split(s, delimiter)
substring(s, start, length)
startswith(s, prefix) endswith(s, suffix)
contains(s, value)
length(s)Math Functions
abs(n) round(n) floor(n) ceiling(n) sqrt(n)
min(a, b) max(a, b) pow(base, exponent)
random() // 0 up to (not including) 1
randomint(min, max) // whole number, inclusive both endsSound
sound(pitch, duration_ms) // hertz or note name like "C4"
bell() // fixed short toneScope, in One Line
Global at the top level, local inside each function call. if, while,
for, for each, and match do not create their own scope.
Reserved Words
var const
if then else end if
while end while
for for each to step next in end for
match when when else end match
break continue
function return end function
attempt error end attempt signal
true false empty
and or not xorCopyright © 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.