|
On Thu, 6 Dec 2001, Buck Calabro wrote:
> >And what is wrong with LEAVE? It hardly
>
> >From a readability point of view, having multiple exit points means that you
> must visually scan every line of code in the routine to see where and when
> it can pop out. This is in contrast to a routine that sets a return code
> and ONLY leaves from the bottom. You don't need to scan the entire routine
> to see where you come out because there's only one exit point.
And the only problem with setting a return code and exiting at the bottom
is that you have to scan every line of code to be sure you don't
accidentally change the return code before returning. Consider:
if (error condition)
return(error)
else
return(success)
endif
vs.
if (error condition)
eval errcode=error
else
eval errcode=success
endif
return errcode
James Rich
james@eaerich.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.