The error control structure
It permits to execute a statement or a bloc of statement
- when the open method fails or
- after any conditional assignement.
As any scriptol structure, it may has the form of a tagged bloc or a single
instruction.
instruction error ...instructions... /error
or: error ? instruction or: error let instruction or: error instruction
The ? sign or let keyword are optional.
The statement inside the body of the control structure is processed only if
an error occurs, and thus if open returns nil.
Example: | file
myfile myfile.open("tutor.txt", "r") error die("file not found") |
If the file "tutor.txt" is not found, the "die" function is called and the program exited, otherwise, it is ignored and it continues.
Exercises |
1) A a variable is assigned the value of another b variable. |