>Hi Guys,
>
>>>>Sounds like a good reason to only have 1 RETURN, at the bottom
>>>>of the routine.
>
>Just an FYI: I read an article by JimB along the lines of "Take the Slow Parts Out", and he mentioned returning early is usually faster than an IF to bypass all the code until the end of the routine. IAC, I don't have a religous preference, just whatever works well at the time.
>
This is one oft touted convention that I don't stick to at all.
Say I have a routine that has to check for several conditions before it can get to the meat of the routine, if any of them fail, it should return .F. instead of running through. If I stick tothe convention that the routine should only exit in one spot, I have to write code that looks like
llAllPass = .T.
IF !SomeCondition
llAlPass = llAllPass AND .F.
ENDIF
IF !SomeOtherCondition
llAlPass = llAllPass AND .F.
ENDIF
And then the rest of the operation code has to be wrapped in IF llAllPassed
Seems much easier and cleaner to me to just
IF !SomeCondition
RETURN .F.
ENDIF
Erik Moore
Clientelligence