Keywords & Literals

Below is the complete list of reserved words recognized by Lunaris. Reserved words cannot be used as the name of a variable, class, or function.

Links point to the most relevant section in the manual. Some entries are aliases or syntax helpers, so they link to the feature they belong to.

Keyword Documentation Kind Description
attempt Attempt Keyword Returns nil when an expression throws
break Break Keyword Stops the current loop or switch case flow
case Switch Keyword Declares a branch inside a switch
catch Try & Catch Keyword Handles an exception thrown in a try block
class Classes Keyword Declares a class
const Constants Keyword Marks a value as immutable
continue Continue Keyword Skips to the next loop iteration
else Else Keyword Runs when previous conditions did not match
elseif Elseif Keyword Adds another conditional branch after if
enum Enums Keyword Declares an enum
exception Exception Keyword Declares a custom exception type
extension Extensions Keyword Extends an existing type with methods
false Bool Literal Boolean literal for false
finally Finally Keyword Runs cleanup code after try / catch
for For Keyword Repeats code over a range or collection
function Function Keyword Declares a function
goto Goto Keyword Jumps to a label
if If Keyword Starts a conditional statement
in For Keyword Iteration keyword used in for (... in ...)
local Variables Keyword Declares a local variable
new Constructor Keyword Creates a new instance of a class
nil Nil Literal Literal representing no value
operator Operator Overloading Keyword Declares an operator overload
private Private Keyword Restricts a member to the declaring class
protected Protected Keyword Restricts a member to the class and derived classes
public Public Keyword Exposes a member publicly
repeat Repeat Keyword Starts a repeat-until loop
return Return value Keyword Returns a value from a function
sealed Sealed Keyword Prevents inheritance or overriding
static Static Keyword Marks a class member or class as static
switch Switch Keyword Compares one value against multiple branches
throw Throw Keyword Throws an exception
trait Trait Keyword Declares a trait
true Bool Literal Boolean literal for true
try Try & Catch Keyword Starts protected code that may throw
until Repeat Keyword Ends a repeat loop when a condition becomes true
while While Keyword Repeats code while a condition is true

Categories:

Updated: