Next: Labeling and referencing Up: PADEL syntax Previous: Multiplex branch |
Exception handlerException handler is defined as a set of processes to be executed when some errors are detected while executing certain set of processes. These error-handling processes are written useing try catch . The syntax is probably obvious from the next example:
try{ for(x = 0, 1, 0.01){ y = f(x) / g(x) print y } }catch(g(x) = 0){ print 'Divided by 0!' } The result is the following:
The output PAD figure is as same as if statement. This is because there is no such concept as exception handler in PAD itself. The rules for putting a return code and { } is as same as that of repetition and conditional branch. If the content of try or catch is in one line, you do not have to enclose the content with { }. You can add a return code before and after { or }, and you can put as many spaces as you like. Hence, the next example is valid. try print sty catch(str = NULL) print 'NULL!' try { print sty } catch (str = NULL) { print 'NULL!' } The next example is invalid. try{ print sty } catch(str = NULL) print 'NULL!'
|
Go back to pad2ps - automatic PAD drawer. Go back to Seiichi Yoshida's Home Page. Copyright(C) Seiichi Yoshida (comet@aerith.net). All rights reserved. Sun Nov 10 01:36:04 JST 1996 |