02-23-2015, 02:25 PM
hi,
I need some help to use error catching, programming for the Prime.
We have IFERR; please, suggest a few example of use for the above purpose...
Then we have also IF TYPE(var) = 5 \\ error ...
My principal goal is to catch errors with parameters or arguments incorrectly entered by the user; i.e. if we have a command myCommand(a, b, c), I want to catch the error if an argument is missing or for error "Bad argument value", to make that program doesn't exit, but give error handled (i.e. a MSGBOX or print() with a string).
An argument can have a default value (a=0) or not, if not and the user don't give it I want to advise him with a meaningful string, instead of the rough, generic, error.
Any hints?
EDIT:
for now, in CAS I'm using something like
but in Home, after many tries, I saw that I must use
argc:= CAS.size(argv);
and I'm not able to use argv:= [args], as it gives error, so I try to use only args directly...
I need some help to use error catching, programming for the Prime.
We have IFERR; please, suggest a few example of use for the above purpose...
Then we have also IF TYPE(var) = 5 \\ error ...
My principal goal is to catch errors with parameters or arguments incorrectly entered by the user; i.e. if we have a command myCommand(a, b, c), I want to catch the error if an argument is missing or for error "Bad argument value", to make that program doesn't exit, but give error handled (i.e. a MSGBOX or print() with a string).
An argument can have a default value (a=0) or not, if not and the user don't give it I want to advise him with a meaningful string, instead of the rough, generic, error.
Any hints?
EDIT:
for now, in CAS I'm using something like
Code:
local argv,argc,...;
argv:=[args];
argc:=size(argv);
a := argv(1);
b := argv(argc);
IF argc=3 THEN ...
but in Home, after many tries, I saw that I must use
argc:= CAS.size(argv);
and I'm not able to use argv:= [args], as it gives error, so I try to use only args directly...