Debian Codegraph @

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

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