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: