Keywords

The following are reserved keywords in Rhai.

Active keywordsReserved keywordsUsage
true, falseconstants
let, constvar, staticvariables
is_sharedshared values
istype checking
if, elsegotocontrol flow
switchmatch, caseswitching and matching
do, while, loop, until, for, in, continue, breaklooping
fn, private, is_def_fn, thispublic, protected, newfunctions
returnreturn values
throw, try, catchthrow/catch exceptions
import, export, asuse, with, module, package, supermodules
globalautomatic global module
Fn, call, curryfunction pointers
spawn, thread, go, sync, async, await, yieldthreading/async
type_of, print, debug, eval, is_def_varspecial functions
default, void, null, nilspecial values

Warning

Keywords cannot become the name of a function or variable, even when they are disabled.