Debian Codegraph @

lang/interpret_test/TestAstFunc2/conditional-scoped-lambda.txtar

raw
1 -- main.mcl --
2 $funcgen = func() {
3 func($b) {
4 if $b {
5 "hello"
6 } else {
7 "world"
8 }
9 }
10 }
11
12 $some_bool = false
13 $fn = if $some_bool {
14 $funcgen()
15 } else {
16 func($bb) {
17 if $bb {
18 "so true"
19 } else {
20 "so false"
21 }
22 }
23 }
24 $out1 = $fn(true)
25 $out2 = $fn(false)
26
27 test "${out1}" {}
28 test "${out2}" {}
29 -- OUTPUT --
30 Vertex: test[so true]
31 Vertex: test[so false]