Skip to content

Keywords

These words can never be a name. They can’t be used for a variable, a function, a parameter, a class, a field, a method, an import alias, a loop label or a sample in a pattern.

KeywordWhat it is
letDeclares a variable. See Variables & Scope
fnDefines a function. See Functions
returnLeaves a function with a value. See Functions
classDefines a class. See Classes
useImports a module. See Modules
asRenames an import. See Modules
privateKeeps a definition out of a module’s exports. See Modules
dspStarts a dsp definition. See DSP Blocks
ifRuns code when a condition holds. See Control Flow
elseThe other branch of an if. See Control Flow
matchPicks a branch by value. See Control Flow
loopRepeats until break. See Control Flow
doRepeats a set number of times. See Control Flow
forIterates. See Control Flow
inNames what for iterates. See Control Flow
breakLeaves a loop. See Control Flow
continueStarts a loop’s next iteration. See Control Flow
assertStops with an error when a condition fails. See Control Flow
trueThe Boolean true. See Values & Types
falseThe Boolean false. See Values & Types
NULThe absence of a value. See Values & Types
PLAYStarts the play head. See Transport
PAUSEHolds the play head where it is. See Transport
STOPReturns the play head to the start. See Transport
RESETDiscards the whole session. See Transport
RECORDPlays, and records the armed tracks. See Transport
SEEKMoves the play head to a cycle. See Transport

Using a keyword as a name is a parse error, reported at the word:

let if = 7;
// → Parse error at 1:5: `if` is a keyword and cannot be used as a name

A keyword only counts when it stands as a whole word, so letter, iffy and PLAYING are all ordinary names.

The words a dsp definition is made of, such as effect, param, state, input, output, range and process, are only keywords where that definition expects them. Everywhere else they are ordinary names. That includes the code inside a dsp definition, and functions such as track.set_input(...) and range(...).

let state = 1;
let input = range(0, 3);
assert state == 1;