Keywords

The following are reserved keywords in Rhai.

Active keywordsReserved keywordsUsageInactive under feature
true, falseconstants
let, constvar, staticvariables
is_sharedshared valuesno_closure
istype checking
if, elsegotocontrol flow
switchmatch, caseswitching and matching
do, while, loop, until, for, in, continue, breaklooping
fn, private, is_def_fn, thispublic, protected, newfunctionsno_function
returnreturn values
throw, try, catchthrow/catch exceptions
import, export, asuse, with, module, package, supermodulesno_module
globalautomatic global moduleno_function, no_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.