ligo/src/test/contracts/simple_access.ligo

22 lines
407 B
Plaintext
Raw Normal View History

2020-02-27 17:51:29 +01:00
//Test simple_access in PascaLIGO
type tpi is int * int
type rpi is record [x : int; y : int]
type mpi is map (string, int)
2019-11-12 17:07:09 +00:00
function main (const toto : tpi) : int is
2020-02-27 17:51:29 +01:00
block {
var a : tpi := toto;
2020-02-27 17:51:29 +01:00
var b : rpi := record [x=0; y=1];
var m : mpi := map ["y" -> 1];
a.0 := 2;
b.x := a.0;
2020-02-27 17:51:29 +01:00
m["x"] := b.x
} with
case m["x"] of
Some (s) -> s
| None -> 42
end