Debian Codegraph @

terps/tads/tads3/test/data/addlist.t

raw
1 #include "tads.h"
2 #include "t3.h"
3
4 _say_embed(str) { tadsSay(str); }
5
6 _main(args)
7 {
8 t3SetSay(_say_embed);
9 main();
10 }
11
12 showlist(lst)
13 {
14 "[";
15 for (local i = 1 ; i <= lst.length() ; ++i)
16 {
17 if (i > 1)
18 " ";
19 tadsSay(lst[i]);
20 }
21 "]";
22 }
23
24 main()
25 {
26 local x = [];
27
28 "initially: x = <<showlist(x)>>\n";
29
30 x += ['one'];
31 "after adding [one]: x = <<showlist(x)>>\n";
32
33 x += ['two'];
34 "after adding [two]: x = <<showlist(x)>>\n";
35
36 x += ['three', 'four'];
37 "after adding [three, four]: x = <<showlist(x)>>\n";
38 }
39