Keywords
Reserved Keywords
These 21 keywords cannot be used as variable names or identifiers
| Keyword | Category | Description |
|---|---|---|
nil |
Value Literal | Represents the absence of a value. |
true |
Boolean Literal | Logical true value. |
false |
Boolean Literal | Logical false value. |
and |
Logical Operator | Performs logical conjunction. |
or |
Logical Operator | Performs logical disjunction. |
not |
Logical Operator | Performs logical negation. |
local |
Declaration | Declares a block-scoped variable or function. |
function |
Declaration | Defines an executable block of code or a function type signature. |
if |
Flow Control | Starts a conditional block or inline conditional expression. |
then |
Flow Control | Separates conditions from execution blocks. |
elseif |
Flow Control | Alternative condition check branch. |
else |
Flow Control | Fallback execution block if preceding conditions evaluate to false. |
end |
Flow Control | Delimits the termination of loops, functions, and conditional blocks. |
do |
Loop / Block | Introduces a scope block or the body of while and for loops. |
while |
Loop | Starts a loop that runs while a condition is truthy. |
repeat |
Loop | Starts a loop block that executes at least once. |
until |
Loop | Specifies the exit condition for a repeat loop. |
for |
Loop | Starts a numeric or generic iteration loop. |
in |
Loop | Delimits loop variables from iterators in a generic for loop. |
return |
Exit Statement | Ends execution of a function and optionally returns values. |
break |
Exit Statement | Immediately exits the innermost enclosing loop. |
Contextual Keywords
These keywords were added later and are recognized only in specific syntactical contexts to avoid breaking older scripts.
| Keyword | Context Use-case | Description |
|---|---|---|
continue |
Inside loop blocks | Skips the rest of the current loop iteration and moves to the next. |
const |
Local declarations | Declares local variables whose bindings cannot be reassigned. |
class |
Top-level block declarations | Declares a native object-oriented class with defined fields and methods. |
public |
Class declarations | Declares a class field. |
export |
Type/Class declarations | Exposes defined types, classes, or values to other scripts requiring the module. |
type |
Type annotations | Declares custom type aliases in the type system. |
typeof |
Type annotations | Extracts the static type of a variable or expression without evaluating it at runtime. |