| 1 | (* A failed check ends the program without running the deferred |
| 2 | statements still pending; what the program wrote is still out. *) |
| 3 | module DeferStop; |
| 4 | import Out; |
| 5 | |
| 6 | proc main*; |
| 7 | var a: [3]I64; i: INT; |
| 8 | begin |
| 9 | defer Out.str("deferred\n"); |
| 10 | Out.str("before\n"); |
| 11 | i := ARGC() + 4; |
| 12 | Out.int(a[i]); |
| 13 | end; |
| 14 | |
| 15 | end DeferStop. |