Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
M.var=bof() or eof() or m.var WHAT???
Message
De
12/07/2001 22:15:22
 
 
À
12/07/2001 22:08:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00530035
Message ID:
00530073
Vues:
21
Jim, you couldn't see the tongue in my cheek!
I hate llRetVal!
My point was; what could be more clear than:
FUNCTION Myfunction
RETURN Blah1 OR Blah2
?
>Hi David,
>
>Obviously the originator didn't understand the construction observed.
>
>It is for that reason that I will generally expand it along the lines that Craig did - why waste anyone's time trying to figure out something can can be expressed much more clearly?
>
>In your second example, though, it is the "llRetVal" that always irks me. What *real* use the "ll" has in there always eludes me. I think that ReturnValue is much clearer. We know returns are logicals and we can be careful to declare it local too. I don't know where a non-local would have much use on a RETURN, really.
>
>JimN
>
>
>>Hi Craig,
>> you know I'm feeling narky today so why not...
>>
>>>X = BOF() OR EOF() OR THIS.TOPFILE
>>>IF M.X = .T.
>>>   THIS.TOPFILE = .T.
>>>ELSE
>>>   THIS.TOPFILE = .F.
>>>ENDIF
>>
>>It just takes up that extra line :-))
>>But seriously, I often see code in production like your example and wonder "why?"
>>BTW, I know it was meant to explain to Todd what was going on, so I'm not having a go at you.
>>
>>I really love this sort of coding...
>>
>>FUNCTION Myfunction
>>* This function returns true if either or both Blah1 or Blah2 are true.
>>LOCAL llRetVal
>>llRetVal = .F.
>>IF Blah1 OR Blah2
>>   llRetVal= .T.
>>ELSE
>>   llRetVal= .F.
>>ENDIF
>>RETURN llRetVal
>>
>>I've seen that so often! ROFL!
>>
>>In any case
>>THIS.TOPFILE = THIS.TOPFILE OR EOF() OR BOF()
>>would normally be best, since it may reduce the overall number of function calls.
>>
>>
>>>It can be rewritten as
>>>
>>>
>>>IF BOF() OR EOF() OR THIS.TOPFILE
>>>   THIS.TOPFILE = .T.
>>>ELSE
>>>   THIS.TOPFILE = .F.
>>>ENDIF
>>>
>>>
>>>>This statement is contained in a class generated through the Application Wizard.
>>>>
>>>>
>>>>THIS.TOPFILE = BOF() OR EOF() OR THIS.TOPFILE
>>>>
>>>>
>>>>I have never seen a statement setting a variable/property = something with additional 'or' conditions.
>>>>
>>>>Could someone explain?
>>>>
>>>>Many thanks,
>>>>
>>>>Todd
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform