ligo/src/test/contracts/expected/match.religo

18 lines
341 B
Plaintext
Raw Normal View History

2020-06-03 12:41:26 +02:00
type storage = int;
type parameter = Add(int) | Sub(int);
type return = (list(operation), storage);
let main =
2020-06-04 09:54:25 +02:00
(((action, store): (parameter, storage))) =>
2020-06-03 12:41:26 +02:00
{
let store =
store
+ (switch(action) {
2020-06-04 09:54:25 +02:00
| Add(n) => n
| Sub(n) => -n
2020-06-03 12:41:26 +02:00
});
(([] : list(operation)), store)
};