Landing
Github
VS code extension
Search…
1.2.9
What is Archetype
Getting started
Usage
Reference
Archetype language
Constants, Variables
Strings
Dates, Durations
Numbers
Crypto
Entries, Functions
Transfers, contract calls
Conversions
Composite types
Basic containers
Assets
Partitions, Aggregates
State machine
Parameters
Metadata (TZIP-16)
Contract specification
Contract library
Governance
Digital Assets
Escrow
Auction
Finance
Insurance
IoT
Framework examples
Powered By
GitBook
Parameters
1
archetype test_parameter(p : nat, n : string)
2
3
variable r : nat = 0
4
5
entry exec () {
6
r := p + length(n)
7
}
Copied!
if you compile with this command:
1
$ archetype test_parameter.arl --init '(1, "astring")'
Copied!
the previous contract is equivalent to:
1
archetype test_parameter
2
3
variable p : nat = 1
4
variable n : string = "astring"
5
6
variable r : nat = 0
7
8
entry exec () {
9
r := p + length(n)
10
}
Copied!
You can also prefix a parameter with
const
keyword which generates a constant instead of a variable.
For example:
1
archetype test_parameter_const(const c : nat)
2
3
variable r : nat = 0
4
5
entry exec () {
6
r := c
7
}
Copied!
with
1
$ archetype test_parameter.arl --init '1'
Copied!
is equivalent to:
1
archetype test_parameter_const
2
3
variable r : nat = 0
4
5
entry exec () {
6
r := 1
7
}
8
Copied!
Previous
State machine
Next
Metadata (TZIP-16)
Last modified
1yr ago
Export as PDF
Copy link
Edit on GitHub