Lil doesn't have a keyword for performing an early return from a function, or otherwise an equivalent of break/continue for each/while loops or a throw/catch exception mechanism. All control flow is strictly structured and local.
For some situations where you might want to guard a clause, you can take advantage of the fact that if ... elseif ... else ... end structures, like all control structures in Lil, are expressions which return their result:
C:
int foo(){
if(cond1){return a;}
if(cond2){foo();return b;}
bar();quux();return c;
}
Lil:
on foo do if cond1 a elseif cond2 foo[] b else bar[] quux[] c end end
I encourage breaking functions down into fairly short definitions. You can nest function declarations within one another if you need "helper" functions that are only used in one place, and those nested functions will close over the lexical scope of their "parent" function.



























