Keywords
Conditionals
if: These are used for conditionals._: The fallback branch value in conditionals.
Errors
error: This is a builtin type for errors.throw: This is a keyword that is used to throw an error. See errors for details.catch: This is a keyword that allows you to capture an error thrown by a function. See errors for details.try: This is a keyword that provides syntax sugar forcatch err { throw err }. See errors for details.
Functions
fn: This is a function definition.return: This is used to return values from a function.
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.enum: This is a keyword for defining enums.int,uint: These are builtin types for signed integers and unsigned integers.float: This is a builtin type for floating point numbers.str: This is a builtin type for strings.struct: This is a keyword for defining structs.interface,impl: These are keywords for defining and implementing interfaces.type: This is a keyword for defining types.void: This is a builtin empty type.mut: This keyword allows a value to be mutable. It can be used with any type.
Values
true: The truthy boolean value.false: The falsy boolean value._: A special name used to discard values.
Loops
for,in: These are used inforloops. Theforsignifies that it’s aforloop, the value beforeincreates a variable that gets the index for each iteration of the loop, and the value afterinis the array over which the loop is iterating.while: This is used inwhileloops. Thewhilesignifies that it’s awhileloop, and the condition afterwhileis 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,as: This keyword allows you to import symbols from modules such as other files or libraries, and assign them to a given module name.extern: This keyword declares external functions implemented outside NC.pub: This keyword allows you to export symbols from a module to be used in other places.
Operators
and: This is the boolean AND operator.or: This is the boolean OR operator.not: This is the boolean NOT operator.in: This is the inclusion operator.
Optionals
none: The empty value in an optional.else: This keyword allows you to declare a fallback code block for an optional.
Async
fut: This creates a Future.async: This marks a function call as asynchronous, and returns a Future. See async for details.await: This awaits a Future to block execution until it resolves and gets a value out. See async for details.mutex: This creates a Mutex.lock: This locks a Mutex and creates a scope where it is mutable so only one thread can access and mutate it. If a thread has a lock, all other threads must wait until the lock is released and they can get their own lock.