| 1 | module OutLines; |
| 2 | (* Out.lines(true) writes each line as it ends, though standard output |
| 3 | is no terminal here: the lines come in order with what is written |
| 4 | past Out. lines(false) keeps them until the end. *) |
| 5 | import Out, Sys; |
| 6 | |
| 7 | proc main*; |
| 8 | begin |
| 9 | Out.lines(true); |
| 10 | Out.str("first\n"); |
| 11 | _ := Sys.write(Sys.stdout, "past Out\n"); |
| 12 | Out.str("second, half"); |
| 13 | _ := Sys.write(Sys.stdout, "past Out again\n"); |
| 14 | Out.str(" and the rest\n"); |
| 15 | Out.lines(false); |
| 16 | Out.str("kept\n"); |
| 17 | _ := Sys.write(Sys.stdout, "past Out, first\n"); |
| 18 | end; |
| 19 | |
| 20 | end OutLines. |