Here is how I might code it:
)
( t
<Rest of Program>
)
)
This avoids the need to use
exit to force an error since the program will cease evaluation of the
cond expression when a test expression returns a non-nil value. Of course, in this particular case where there is only a single condition to be tested, an
if expression could also be used in place of the
cond expression, however, usually there is more than one error condition to be checked, and so
cond becomes more suitable (and readable) than multiple nested
if statements.
In fact, I use this construct in almost all of my programs which utilise DCL, as, in my opinion, it is cleaner than using
exit, doesn't necessarily require an
*error* handler, and furthermore retains the flow of the code (i.e. the program is being evaluated line by line rather than aborting).
My 2p