Constants, Variables

Constant

A constant is a global value that cannot be changed. The following snippet defines a global constant named price typed tez equal to 10 tez:
1
constant price : tez = 10tz
Copied!
The following defines a string typed constant named msg :
1
constant msg : string = "Hello world"
Copied!
Note that constant values are not transcoded to contract storage: they may be seen as convenient aliases when writing contract's code.

Variable

A variable is a global value that can be changed. The following snippet defines 2 global variables named seller and buyer typed address equal to a (here random) addresses:
1
variable seller : address = @tz1KksC8RvjUWAbXYJuNrUbontHGor25Cztk
2
variable buyer : address = @tz1KUbontHGor25CztkksC8RvjUWAbXYJuNr
Copied!
Last modified 7mo ago
Export as PDF
Copy link
Edit on GitHub