Files
aqua-playground/aqua/examples/constants.aqua

30 lines
598 B
Plaintext
Raw Normal View History

2021-06-15 17:06:08 +03:00
import "@fluencelabs/aqua-lib/builtin.aqua"
2021-04-23 17:21:58 +03:00
2021-04-28 03:26:26 +03:00
service Getter("test"):
2021-06-15 17:06:08 +03:00
createStr: u32 -> string
2021-04-28 03:26:26 +03:00
2021-06-15 17:06:08 +03:00
service OpO("op"):
identity: string -> string
2021-04-23 17:21:58 +03:00
2022-03-09 17:54:15 +03:00
service OpN("op"):
identity: i32 -> i32
2021-04-23 17:21:58 +03:00
-- a question mark means that this constant could be rewritten before this definition
2021-09-01 15:01:01 +03:00
const ANOTHER_CONST ?= "default-str"
const UNIQUE_CONST ?= 5
2021-04-23 17:21:58 +03:00
2021-06-15 17:06:08 +03:00
func callConstant() -> []string:
res: *string
2021-09-01 15:01:01 +03:00
res <- Getter.createStr(UNIQUE_CONST)
res <- OpO.identity(ANOTHER_CONST)
2021-06-15 17:06:08 +03:00
<- res
2022-03-09 17:54:15 +03:00
const A = 2
const B = -3
func compareConstants():
if A == B:
OpN.identity(A)
else:
OpN.identity(B)