Debian Codegraph @

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

raw
1 /*
2 * anonymous functions
3 */
4
5 #include "tads.h"
6 #include "t3.h"
7
8 class RuntimeError: object
9 construct(errno, ...) { errno_ = errno; }
10 display = "Runtime error: <<exceptionMessage>>"
11 errno_ = 0
12 exceptionMessage = ''
13 ;
14
15 _say_embed(str) { tadsSay(str); }
16
17 _main(args)
18 {
19 try
20 {
21 t3SetSay(&_say_embed);
22 main(args);
23 }
24 catch (RuntimeError rte)
25 {
26 "\n<<rte.display>>\n";
27 }
28 }
29
30 main(args)
31 {
32 local i;
33
34 for (i = 1 ; i < 10 ; ++i)
35 {
36 {
37 local j;
38
39 j = i * 10;
40 "i = <<i>>, j = <<j>>... ";
41 }
42
43 local k;
44
45 if (i == 1)
46 k = 123;
47
48 "k = <<k>>\n";
49 }
50 }
51