Debian Codegraph @

lang/interpret_test/TestAstFunc2/lookup1.txtar

raw
1 -- main.mcl --
2 $l1 = ["a", "b", "c",]
3
4 $l2 = [$l1, ["hello", "world",],]
5
6 test [$l1[0],] {}
7 test [$l1[2],] {}
8 test [$l1[3] || "pass",] {}
9 test $l2[1] {}
10
11 $map1 map{int: str} = {42 => "hello1",}
12 $name1 = $map1[42]
13 test "${name1}" {}
14
15 $map2 map{int: str} = {42 => "hello2",}
16 $name2 = $map2[13] || "world2"
17 test "${name2}" {}
18
19 $map3 = {42 => "hello3",}
20 $name3 = $map3[42]
21 test "${name3}" {}
22
23 $map4 = {42 => "hello4",}
24 $name4 = $map4[13] || "world4"
25 test "${name4}" {}
26
27 $map5 = {"wow" => "pass1",}
28 $name5 = $map5["wow"]
29 test "${name5}" {}
30
31 -- OUTPUT --
32 Vertex: test[a]
33 Vertex: test[c]
34 Vertex: test[hello1]
35 Vertex: test[hello3]
36 Vertex: test[hello]
37 Vertex: test[pass1]
38 Vertex: test[pass]
39 Vertex: test[world2]
40 Vertex: test[world4]
41 Vertex: test[world]