× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Charles Wilt wrote:

>>But experience with some of the hoops I've coded to jump through in
order to
>>have only one return has made me reconsider.

>>As a maintenance programmer, I'd much rather deal with multiple
RETURNs instead 
>>of nested IFs.

I agree totally. I've even come across code where, in order to 'enforce'
the 'single-entry, single-return' maxim, you get this within a
subprocedure:

if (some condition);
  exsr return;
endif;

if (another);
  exsr return;
endif;

if (yet another condition);
  exsr return;
endif;

... (repeated for lots of other code)..

return begsr;
  return;
endsr;

*pssr begsr;
(error processing)
exsr return;
endsr;

Now I can see that if you want to have some exit-specific code, then
maybe it's a good method (because you can add your code before the
return statmnent within the  return subroutine), but on the downside,
you have multiple if's (not nested in this example, but they probably
are in real life!), the equivalent of lots of RETURN's throughout the
procedure, AND a subroutine, which  some on this forum will consider the
biggest sin of all :-)

But there's a single return point, so THAT's ok.

Rory


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.