Assurance Keywords
Keywords used to test and guarantee correct performance.
There are 3 assurance keywords. These are used to guarantee a resource is present or correct.
Assert
Assertions make sure a value is equal to (or evaluates to) true
.
Assertions are designed for testing whether a program or its environment is correct.
If an assertion fails the script will stop and print an error (e.g. assert false
).
Require
Requirements make sure a variable exists.
Requirements are designed for testing whether a function (or script) has been given the correct inputs.
If a requirement fails the script will stop and print an error.
Requirements can also be used to convert anonymous arguments into named variables.
Import
Imports fetch a resource from a different script or program.
There are several built-in libraries that you can import (e.g. math
, parser
).
You can also import the result of a different script.
Importing a script stores its result in a named variable.
Last updated