Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
M.var=bof() or eof() or m.var WHAT???
Message
De
17/07/2001 00:54:44
 
 
À
16/07/2001 05:46:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00530035
Message ID:
00531362
Vues:
14
Len,
Looks good to me! The risk, slight though it may be, is that some other coder will come along and edit it without thinking of the consequences and convert it back to
THIS.TOPFILE= IF BOF() OR EOF()
thereby destroying the intent of the code.
So you need some comments!
IF BOF() OR EOF()
  THIS.TOPFILE = .T.
*ELSE
*  leave THIS.TOPFILE alone!
ENDIF
Some of my training years ago was in Prolog and so I'm biased in favour of strings of logicals. We once had to solve the Towers of Hanoi problem for five disks using nothing but True or False statements producing a text only graphical output to a line printer. That was fun!
Here's the three disk problem. Move the three disks to stand C never having more than once disk at a time off.
     |       |       |
    ===      |       |
   =====     |       |
  =======    |       |
  ---+--- ---+--- ---+---
     A       B       C

Now try for five disks.

>In all seriousness though, what's wrong with :
>
>
>IF BOF() OR EOF()
>  THIS.TOPFILE = .T.
>ENDIF
>
>
>or
>
>
>IF (BOF() OR EOF())
>  THIS.TOPFILE = .T.
>ENDIF
>
>
>I think that final "OR THIS.TOPFILE" to retain the value of THIS.TOPFILE in the event of not being at top or bottom of the file leads to confusion if you're not familiar with that type of construct.
>
>Part of my work involves programming PLCs with ladder logic, where it is common to use the equivalent structure to ensure an output stays on regardless of what happened to the inputs that set it in the first place. But I've found that when I translate that to C (or Foxpro), it does confuse people, so I tend to use the above.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform