160 IF TXT < 0 THEN THROW TXT
I looked in the reference manual and can't decipher what "throw" does.
Can you help?
Thanks
Jim
THROW is something that will throw an exception. The run-time errors that a running CoreBASIC program can throw (and be caught using TRY) are usually generated internally (e.g. subscript out of range). Each CoreBASiC error is assigned a specific number and the REPORT() function will turn that error number into a string. And, in fact, many device errors are handled the same way, with CoreBASIC throwing low-level device errors direct from the Platform layer.
You can do the same. If you get a status code back from a function, you can use THROW to turn it into an exception and, if it's not caught, then it terminates the program with a runtime error, the error that THROW threw. But you could equally THROW -999 and see what that does at the command line. -999 is an unknown code, i.e. there is nothing that can turn it into a human-readable description as the kernel doesn't know what it is.
THROW is there for the moment; but it's intended that the CoreBASIC exception handling mechanism is extended to make TRY and THROW more convenient. As this is not fully written yet, THROW remains undocumented.