hsedit/examples/example2
2016-08-29 13:39:26 +02:00

26 lines
840 B
Text

{
error = "0";
fact = { % number num -> number; set error if something is wrong
"num = a"
% num = "b"
continue = {} + ("test 1 -ge " + num).syscall;
[ continue = "0" :
[ {} + ("test 0 = " + num).syscall # "0" :
*error = "1";
]
^ "1";
]
nextnum = { in = *num + "-1"; } + "bc -lq".iosyscall;
[ nextnum.result = "0" :
result = { in = { num = **nextnum.out; } + **fact + "*" + *nextnum.out; } + "bc -lq".iosyscall;
[ result.result = "0" :
^ result.out;
]
]
*error = "2";
^ "0";
}
value = { num = "5"; } + fact;
[ error = "0" : { in = "result: " + *value; } + "echo".iosyscall; ]
[ error # "0" : { in = "error #" + *error; } + "echo".iosyscall; ]
}