Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
List declaration in Scilla
contract Lists()
field a: List(Int32)= Nil {Int32} (*declaring variable a with no value*)
field b: List(Int32) = let c = Nil {Int32} in
let d = Int32 5 in
Cons{Int32} d c (*declaring variable b with fixed value*)
transition update_value()
(*updating variable a*)
e <- a;
f = let g = Int32 6 in
Cons {Int32} g e; (*declaring variable f with fixed value in the transition *)
a := f; (*variable a now contains list 6<-Nil*)
(*updating variable b*)
h <- b;
i = let j = Int32 7 in
Cons {Int32} j h;
b := i (*variable b now contains list 7<-5<-Nil*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment