Skip to content

Keywords

Keywords are reserved and can’t be used as variable, function or parameter names. The type names at the end are reserved too.

KeywordMeaning
fnDefines a function or method. See Functions.
defAlias for fn.
varDeclares a variable, optionally with a type hint. See Variables.
constDeclares a constant. See Variables.
structDefines a struct. See Structs.
abstractMarks a struct that can’t be instantiated, or a method children must implement.
staticDeclares a struct-level method or variable.
privateMarks a method as internal to its struct.
overrideMarks a method that overrides a parent method. Informational.
superCalls the parent struct’s version of a method.
enumDefines an enumeration. See Enums.
packageDefines a package. See Packages.
interfaceReserved for future use.
KeywordMeaning
if, elsif, elseConditional branches. See Control Flow.
case, whenMulti-way branch expression. when also guards statements.
endCloses a block.
for, inIterates over a collection. See Loops.
whileLoops while a condition holds.
repeat, asLoops a fixed number of times, optionally naming the counter.
doOpens a loop body or a lambda.
toBuilds an inclusive range: [1 to 10].
breakLeaves the innermost loop.
nextSkips to the next loop iteration.
returnReturns from a function.
yieldProduces a value from a generator.
exitEnds the program with an exit code.
KeywordMeaning
try, catch, finallyHandle errors. See Error Handling.
throwRaises an error.
KeywordMeaning
withAlternative way to open a lambda: with (x) do ... end. See Lambdas.
KeywordMeaning
importActivates a package or loads a file, and returns a package reference.
includeLoads a file.
requireAsserts that a package is available.
exportActivates a package.

See Packages.

KeywordMeaning
onRegisters an event handler. See Events.
onceRegisters a handler that runs once.
emitTriggers an event.
offRemoves event handlers.
KeywordMeaning
print, printlnWrite to stdout, without or with a newline.
eprint, eprintlnWrite to stderr.
printxyWrite at a terminal position.
evalRun a string as Kiwi code.

See Global Functions.

KeywordMeaning
and, or, notLogical operators, same as &&, || and !.
true, falseBoolean values.
nullThe absence of a value.
SymbolMeaning
@The current struct instance. @name is an instance variable.
@@nameA static struct variable.
@name above fnA decorator.
::Package access: math::sqrt.
=>Separates a lambda’s parameters from its expression.
..Range, same as to.
...An empty statement placeholder.
#, /# #/Comments.

integer, float, boolean, string, list, hashmap, lambda, object, date, bytes, pointer, generator, any and none are type keywords used in type hints. They can’t be used as names; quote them when you need them as hashmap keys.