Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
To iif or not to iif = .t.
Message
De
01/06/2001 23:02:52
 
 
À
01/06/2001 21:29:12
Al Doman (En ligne)
M3 Enterprises Inc.
North Vancouver, Colombie Britannique, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00513276
Message ID:
00514145
Vues:
15
Al,

SNIP
>>
>>If you were to look at LOOP or EXIT as just a shorthand for an IF statement, which seems a legitimate viewpoint to me, then there is no real difference - both result in specific code being bypassed. And at least LOOP and EXIT do exactly what their words *mean*. The CONTINUE command sure doesn't (in my humble opinion).
>
>I think we're discussing two slightly different things. You're right that with LOOP and EXIT you can visually trace what's going to happen next. My objection is that they slice through nested logic, which if coded elegantly may require cleaning up after itself when each level terminates.
>
>I find when I'm coding complex logic and working from truth tables, there is no way I can even conceive of using an EXIT or LOOP. But then, that's just me ;-)
Clearly a matter of personal taste as I see it.
In my view LOOP and EXIT can significantly reduce the complexity (apparent and otherwise) of code. If I was going to outlaw Loop/EXIT I would simply have to replace them with (quite possibly multiple) IF statements where half of the IF does *nothing* as the IF's sole purpose is to recognize a condition and prevent execution of some code). I really don't see where that helps anything, particularly readability. And I have a personal distaste for revising a counter (to make it end a FOR) or forcing a condition (to make it end a WHILE) WITHIN A BLOCK OF CODE. To me an EXIT or a LOOP is far more obvious and makes for easier maintainability.

In any case my point was to argue that EXIT/LOOP does *not* make for unstructured code and on that I think we now agree.

Regards,

JimN
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform