Go to the first, previous, next, last section, table of contents.
- error(message)
-
:: Forces Asir to cause an error and enter debugging mode.
- message
-
string
-
When Asir encounters a serious error such that it finds difficult
to continue execution,
it, in general, tries to enter debugging mode before it returns to
top level.
The command
error()
forces a similar behavior in a user program.
-
The argument is a string which will be displayed when
error()
will be executed.
-
You can enter the debug-mode when your program encounters an illegal
value for a program variable, if you have written the program
so as to call
error()
upon finding such an error in your program
text.
% cat mod3
def mod3(A) {
if ( type(A) >= 2 )
error("invalid argument");
else
return A % 3;
}
end$
% asir
[0] load("mod3");
1
[3] mod3(5);
2
[4] mod3(x);
invalid argument
stopped in mod3 at line 3 in file "./mod3"
3 error("invalid argument");
(debug) print A
A = x
(debug) quit
return to toplevel
[4]
- References
-
section
debug
.
Go to the first, previous, next, last section, table of contents.