Keywords
Keywords are reserved words that cannot be used as names in declarations. In some cases you can escape keywords to use them as variables or record fields.
Escaping keywords
Keywords cannot be used as variables or record fields. If you need to
use a keyword as a variable, you can prefix it with @
, like so:
const @from = ("tz1fakefakefakefakefakefakefakcphLA5" as address)
However, you cannot escape decorators in this way because the convention of escaping a keyword with the @
symbol conflicts with that of decorators, as found in JavaScript.
For example, @entry
is invalid as a variable.
List of keywords
JsLIGO's keywords are the following:-
as
-
break
-
case
-
const
-
continue
-
contract_of
-
default
-
do
-
else
-
export
-
false
-
for
-
from
-
function
-
if
-
implements
-
import
-
interface
-
let
-
match
-
namespace
-
of
-
parameter_of
-
return
-
switch
-
true
-
type
-
when
-
while
-
@entry
-
@deprecated
-
@dyn_entry
-
@inline
-
@view
-
@no_mutation
-
@private
-
@public
-
@hidden
-
@thunk
-
@annot
-
@layout