Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
M.var=bof() or eof() or m.var WHAT???
Message
De
13/07/2001 08:46:45
 
 
À
12/07/2001 21:53:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00530035
Message ID:
00530168
Vues:
22
I agree with you. I was just responding with what the one line of code does. I usually use the one line method. However, I would write it like:
THIS.TOPFILE = (THIS.TOPFILE OR EOF() OR BOF())
Note the additional parens. IMO, is makes it a bit easier to read, especially if the one line is something like:
llFlag = (MyVar = SomeFunction())
Leaving off the parens is more confusing in this case

>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
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform