|
> From: Francis Lapeyre > > I have to agree with Tom. Sometimes, it's either multiple RETURNS or use > (gasp!) GOTO/TAG. Actually, I'm going to argue a couple of points here. First, the hard-science programming side of it: If your language provides an IF/ELSE/ENDIF and a LEAVE operation for looping constructs, then you should never need a GOTO. Following that line of thought, with the proper use of "accepted" structured programming constructs, you should never need multiple returns. Second, coding multiple returns in a routine CAN be a bad technique in and of itself. Multiple returns get to be problematic when you're actually returning a value, and the value you return depends on which point you're exiting from. Even with a breakpoint on a P-E, it can be difficult to tell what is actually being returned. And if the calling routine is not placing the value into a temporary value but instead using it as a parameter to another routine (possibly one for which you have no source), or worse yet returning the value to ITS caller, the code can get difficult to debug. That being said, I'm not against multiple returns. There are few things I am adamantly opposed to because of their intrinsic nature. But be consistent and use common sense, and you'll be okay. Joe
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.