1.8 KiB
1.8 KiB
id | title | description | hide_table_of_contents |
---|---|---|---|
toplevel | Toplevel | Available functions at the top level | true |
import Syntax from '@theme/Syntax'; import SyntaxTitle from '@theme/SyntaxTitle';
These functions are available without any needed prefix.
function is_nat: int -> option(nat) val is_nat: int -> nat option let is_nat: int => option(nat)Convert an int
to a nat
if possible.
Cast an int
to nat
.
Cast an nat
to int
.
A helper to create a unit.
function failwith : string -> unit function failwith : string -> unit function failwith : string -> unitCause the contract to fail with an error message.
function assert : bool -> unit function assert : bool -> unit function assert : bool -> unit⚠ Using this currently requires in general a type annotation on the
failwith
call.
Check if a certain condition has been met. If not the contract will fail.