ligo/src/test/contracts/condition.ligo

17 lines
322 B
Plaintext
Raw Normal View History

// Test if conditional in PascaLIGO
2019-05-13 00:56:22 +04:00
function main (const i : int) : int is
begin
var result : int := 23 ;
2019-05-13 00:56:22 +04:00
if i = 2 then
result := 42
else
result := 0
end with result
function foo (const b : bool) : int is
begin
var x : int := 41 ;
x := 1 + (if b then x else main(x)) ;
end with x