Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
To iif or not to iif = .t.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00513276
Message ID:
00514508
Vues:
20
>>> Thanks a lot for the suggestions, George. I already changed for next to do while and get rid of the top loop (unnecessary, as you fairy noted - this that I've done without reading this message). Now I'm going to proceed with your suggestions.
>>>
>>>Thanks.
>>
>>Nadya,
>>
>>You're welcome. Let me emphaize one thing. These are general guidelines. For example, my point about the inner of the two loops was based on the concept that, under the circumstances, this routine would only apply to tables connected with a DBC. My thought was, "Well, what about free tables? Why write essentially the same code twice to handle the,?" You know the answers to these questions far better than I.
>>
>>The rules are there for a purpose. Sometimes you have to break them in order to accomplish what needs to be done. However, before doing so, I try to make absolutely certain that the conditions of the problem require it, and there isn't a better way to accomplish the same thing.
>
>George,
>
>I changed the code (see bellow), but something bothers me. It seems that do while conditions are checked only when I rich the last enddo command. In other words,
>
>do while !Stop
>  if Somecondition
>      Stop=.t. && instead of immediate termination, this would terminate only after enddo
>  endif
>edndo
>
> May be it's only impression, but why I had to use do while lnK>instead of do while m.lnK<=m.lnCount? If I put <=, I get an error.

Is lnk being initialized? If it's only declared, then the default value is .F. In general this sort of situation is handled in the following:
* lnlast is the maximum number of iterations
lni = 0
llStop = lSomeCondition
DO WHILE lni < lnlast AND NOT llStop
  lni = lni + 1
  * Code here
  llStop = lSomeCondition
ENDDO
This pre-test structure will not execute if lnlast equals zero or llStop is initially set to .T. It will terminate, if executed if lni equals lnlast or if at some point llStop equals .T.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform