ligo/src/test/contracts/closure.mligo

10 lines
251 B
Plaintext
Raw Normal View History

2019-11-21 18:02:47 +04:00
(* Test whether closures retain values in CameLIGO *)
let test (k: int) : int =
let j: int = k + 5 in
let close: (int -> int) =
fun (i: int) -> i + j
in
let j: int = 20 in (* Shadow original variable to see if value close'd *)
close 20