ligo/test/contracts/website2.ligo
2019-09-09 11:47:42 +02:00

19 lines
573 B
Plaintext

// variant defining pseudo multi-entrypoint actions
type action is
| Increment of int
| Decrement of int
function add (const a : int ; const b : int) : int is
block { skip } with a + b
function subtract (const a : int ; const b : int) : int is
block { skip } with a - b
// real entrypoint that re-routes the flow based on the action provided
function main (const p : action ; const s : int) : (list(operation) * int) is
block {skip} with ((nil : list(operation)),
case p of
| Increment (n) -> add (s, n)
| Decrement (n) -> subtract (s, n)
end)