>Procedure someproc >*-- Evan would replace >* Local ... >*-- with >Local luReturnValue, ... >With This > If !.GetValidDateRanges() > *-- Evan would replace > * Return .F. > *-- with > luReturnValue = .F. > Endif > * Some other code ... > Select ... From ...Into Array .arrItems > If Type('.arrItems[1,1]')#'N' > *-- Evan would replace > * Return .F. && No items > *-- with > luReturnValue = .F. > Endif > For ix=1 To Alen(.arrItems,1) > If .arrItems[ix,2] = 'somecondition' > *-- Evan would replace > * Return .SomeOtherProc(ix) > *-- with > luReturnValue = .SomeOtherProc(ix) > Endif > If .arrItems[ix,3] = 'somecondition2' > *-- Evan would replace > * Return .SomeOtherProc2(ix) > *-- with > luReturnValue = .SomeOtherProc2(ix) > Endif > Endfor > * Some other code where also there are few other returns ... >Endwith >*-- Evan would add here: >RETURN ( luReturnValue ) > >Endproc >>
If luReturnValue and .arrItems[ix,3] = 'somecondition2' luReturnValue = .SomeOtherProc2(ix) Endifand it would still not be exactly the same, because return .someotherproc2(ix) could have returned .t. - and your code would still continue processing.
llOK=.f. do case case not this.firstcheck() case not this.secondcheck() case not this.thirdcheck() ... case not this.enthcheck() otherwise llOK=.t. endcase return llOKThis, of course, works just because all the check functions are returning .t. for success, .f. for fail. If the functions in Cetin's case were supposed to return some other type of result if successful, and .f. if they fail, then it's either getting done his way (with returns all over the place), or will be very complicated, because you'd have to do all the checking after each call, and keep luRetValue for value, and llContinue as an indicator of whether to go into any further tests (to simulate early return).