>>I agree entirely. I consider EXIT and LOOP to be bugs until proven otherwise :-) Almost without exception, it's an indication that the coder hasn't thought the logic through clearly, making the entire structure suspect.
>
>I consider them the VFP equivalent of < shudder > GOTO...:-)
>
>>Personally, I also consider an IF statement without an ELSE in the same class.
>
>Sometimes, I think that this is ok consider:
FUNCTION SomeFunc
>
> LOCAL lnresult
> lnresult = 0
> IF < Some logical expression >
> lnresult = 99
> ENDIF
> RETURN lnresult
>ENDFUNC
>I tend to initialize my return variables almost immediately. Add ing an ELSE here might be overkill. Normally, most of my methods are around 20 lines so it's easy to see what's going on.
Personally, I would
LOCAL lnresult
IF < Some logical expression >
lnresult = 99
ELSE
lnresult = 0
ENDIF
RETURN lnresult
When I look at your example, I see the logical expression and I can see that if it's .T. then the value is 99. But to me, it begs the question, what is the value otherwise? I consider this like encapsulation in some ways - I like to be able to determine the value here, not by having to look elsewhere.
You're disciplined enough to keep your functions to 20 lines, so it's easy to find the initialized value. Others (like me) aren't so lucky.
I would guess that my way is more efficient, too; if the expression is .T. you have two assignations instead of just one.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up