lang/interpret_test/TestAstFunc2/lookup2.txtar
raw| 1 | -- main.mcl -- |
| 2 | |
| 3 | $st1 = struct{ |
| 4 | a => 42, |
| 5 | b => true, |
| 6 | c => "pass1", |
| 7 | } |
| 8 | |
| 9 | test [$st1->c || "default",] {} |
| 10 | test [$st1->missing || "pass2",] {} |
| 11 | |
| 12 | $st2 = struct{ |
| 13 | a => 42, |
| 14 | b => true, |
| 15 | c => "pass3", |
| 16 | } |
| 17 | |
| 18 | test [$st2->c,] {} |
| 19 | #test [$st2->missing + "fail",] {} # this can't unify! (by design!) |
| 20 | |
| 21 | -- OUTPUT -- |
| 22 | Vertex: test[pass1] |
| 23 | Vertex: test[pass2] |
| 24 | Vertex: test[pass3] |