Keywords
Conditionals
if
,else if
,else
: These are used for basic conditionals.match
,else
: These are used for pattern matching.
Functions
fn
: This is a function definition.try
: This is a keyword that is required to call a function that may throw. It doesn't do anything specific on its own, however it makes it clear to someone reading the code that the function they're calling could throw. It also colors the function it's being called in, and that containing function also becomes a throwing function. See error handling for details.
Types
bool
: This is a builtin type for booleans.byte
: This is a builtin type for bytes.char
: This is a builtin type for characters.complex
: This is a builtin type for complex numbers.decimal
: This is a builtin type for decimal numbers.enum
: This is a keyword for defining enums.error
: This is a builtin type for errors.int
,uint
,bigint
: These are builtin types for integers.str
: This is a builtin type for strings.struct
: This is a keyword for defining structs.type
: This is a keyword for defining types.union
: This is a keyword for defining a union type.mut
: This keyword allows a value to be mutable. It can be used with any type.
Loops
for
,in
: These are used infor
loops. Thefor
signifies that it's afor
loop, the value beforein
creates a variable that gets the value for each iteration of the loop, and the value afterin
is the array over which the loop is iterating.while
: This is used inwhile
loops. Thewhile
signifies that it's awhile
loop, and the condition afterwhile
is checked each time the loop is run. If the condition is true, the loop continues, if not, it breaks and the program continues execution after the loop.break
,continue
: These are used to break and continue loops, and can optionally be used with labels. See Labels,break
, andcontinue
.
Modules
import
: This is used to import modules from other files or libraries.as
: This is used to alias imports to give them custom names, instead of depending on the filename.
Other
return
: This is used to return values from a block. This can be returning values from a function, or returning a value from a conditional block into a variable, like anif-else
statement ormatch
statement.