Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Argument starter - The roots of all evil
Message
De
01/09/2004 10:25:33
 
 
À
01/09/2004 10:18:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00938079
Message ID:
00938401
Vues:
29
My statement was purely for fun. However, both LOOP and EXIT do exist, so I must confess that I use them in some places. I know how to avoid theme, but why bother? I think the discussion is pretty similar to 'shall a function or a procedure have only one RETURN?'. Most people will say 'yes', but sometimes it simply is easier to have more RETURNs.

>LOL
>
>No, it should be:
>
>
>DO CASE
>   CASE cPlane='Open biplane' AND nNumberOfUnwantedPassenger>0
>       LOOP de LOOP
>   ...
>
>
>:-)
>
>Seriously though, Tore, if your opening statement was not just for the fun show me where the control loop is and I'll see how invaluable looop and exit are.
>
>Terry
>
>>In some situations both LOOP and EXIT are invaluable:
>>DO CASE
>>   CASE cPlane='Open biplane' AND nNumberOfUnwantedPassenger>0
>>       LOOP
>>   CASE lSick
>>      GOTO LOO
>>      DO WHILE lBusy
>>         RETRY
>>      ENDDO
>>      THROW UP
>>   CASE lThursty
>>       CALL cSteward
>>   OTHERWISE
>>       FINALLY
>>       EXIT
>>ENDCASE
>>
>>
>>
>>>Hi all
>>>
>>>I would argue that the introduction of those evil commands - LOOP and EXIT - was just for lazy programmers who can't be bothered to restructure (indent etc.) their control loops when they suddenly discover another condition, or change necesaary to the loops. They are unnecessary and should never have been introduced. Personally I have managed NEVER to use them. When you have to debug someone else's labrythine, monolithic code, with 20 yard long do while loops, and short-circuiting loops and exits liberally scattered in the code, just to complicate it even further, like I have, then you'd get to hate them.
>>>
>>>I'd challenge anyone to present code where they're necessary.
>>>
>>>While I'm at it, don't get me started on multiple RETURN statements in a function ...
>>>
>>>:-)
>>>
>>>Terry
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform