Two things:
1. I think that the documentation of @maxerrcount is somewhat confusing. Perhaps this confusion stems from me not being a native English speaker, but the way I read the documentation ("the maximum number of errors that a program may encounter before execution is halted"), I thought that if @maxerrcount for instance was set to 1, then execution would not stop when encountering the first error but rather at the second error.
2. Beyond me misinterpreting the documentation, I had made another coding error (writing setmaxerr instead of setmaxerrs). I have corrected it in the original question.
A functioning version of my somewhat convoluted code to check if a control variable is undefined is:
Code: Select all
!old_maxerrcount = @maxerrcount
if @maxerrcount <= @errorcount + 1 then
setmaxerrs {!old_maxerrcount} + 1
endif
!old_errorcount = @errorcount
if !possibly_defined_variable then
endif
if @errorcount > !old_errorcount then
@uiprompt("UNDEFINED")
else
@uiprompt("defined")
endif
seterrcount {!old_errorcount}