Commit eb615e87a267e00597231bc5c8779281a33ccf36
1 parent
5acb1a5b
added an example of use of 'restart'.
Showing
1 changed file
with
41 additions
and
0 deletions
Show diff stats
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + This is an example of use of the primitives 'restart' and 'will_restart' defined in | |
| 5 | + 'predefined.anubis'. | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | +read tools/basis.anubis | |
| 10 | + | |
| 11 | + | |
| 12 | +define One | |
| 13 | + empty_stdin | |
| 14 | + = | |
| 15 | + if *stdin is | |
| 16 | + { | |
| 17 | + failure then unique, | |
| 18 | + success(c) then | |
| 19 | + if c = 10 | |
| 20 | + then unique | |
| 21 | + else empty_stdin | |
| 22 | + }. | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | +global define One | |
| 27 | + restart_example | |
| 28 | + ( | |
| 29 | + List(String) args | |
| 30 | + ) = | |
| 31 | + with response = prompt("Do you want to restart ? [Y/N]: "), | |
| 32 | + empty_stdin; | |
| 33 | + if (response = "Y" | response = "y") | |
| 34 | + then (restart(true); print("Please wait...\n")) | |
| 35 | + else if (response = "N" | response = "n") | |
| 36 | + then (restart(false); print("Exiting for ever !\n")) | |
| 37 | + else print("I did not understand the answer: <<"+response+">>\n"). | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 0 | 42 | \ No newline at end of file | ... | ... |