-
Notifications
You must be signed in to change notification settings - Fork 0
Keywords
circular17 edited this page Mar 15, 2024
·
10 revisions
-
let
introduces a constant. -
var
introduces a variable. It can be used within a record. -
fun
introduces a function with a return value. -
sub
introduces a subroutine i.e. a function without return value. -
enum
introduces an enumerator function or lambda. -
type
introduces a named type. -
alias
introduces a type alias.
-
any
represents any type. -
set
prefixes a set of value, or introduces the setter of a property within a record. -
dict
prefixes a dictionary. -
yes
andno
are the two possible boolean values.
-
var
as seen above modifies a member of a record to be a variable. -
const
modifies a member to be a constant (cannot even be modified when cloning the record). -
base
specifies that a base member is required or assigned. -
init
specifies that a member needs to be defined in the constructor. -
prop
introduces a property of a record. -
new
starts the constructor block of code (ended withend
keyword).
-
async
appears beforefun
orsub
to modify a function to be asynchronous. -
global
appears beforefun
orsub
to modify a function to be accessible outside of module even if the module is not imported explicitly (useful for operator overloading). -
defer
is a suffix to a function called to return the promise instead of the result. -
mut
is a prefix to a parameter to indicate its content is going to be changed by the function. -
return
returns to the caller (useful to exit in advance). -
yield
returns one value for the sequence and pauses until next element is queried.
-
do
starts a code block. Alternatively a function result can be defined with an arrow=>
and an inline block is within braces{
...}
. -
end
ends a code block. -
wise
after a variable introduce a wise block where the variable members are directly accessible. -
when
introduces the error matching block. -
resume
instructs to resume execution after an error.
-
while
introduces a conditional loop. -
repeat
repeats while thenext
instruction is encountered -
each
introduces a loop on the elements of the value to its left -
break
exits current loop -
next
skip loop iteration
-
or
is the logical disjunction and symmetric to the&
operator. -
xor
is the exclusive or. -
in
checks if an element is within a collection. -
else
is for the alternative in the ternary expression: ...?
...else
... -
by
allows to specify a step for a range