Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TRY.. ENDTRY EXIT clause name is a good choice ?
Message
De
20/09/2003 11:23:33
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
TRY.. ENDTRY EXIT clause name is a good choice ?
Divers
Thread ID:
00830864
Message ID:
00830864
Vues:
53
Hi,

on TRY... ENDTRY exist the EXIT clause; it cut the block code and skip to the next block.

But EXIT is also the command in order to describe the escape from a cycle.

Then,
- i can exit by the TRY block force a catch with THROW clause, also within a loop cycle;
- but i can exit by the TRY block with a EXIT clause only if this clause is not within a loop cycle ( EXIT go out of the loop, no out of the block ).
CLEAR
TRY
 DO WHILE .T.
  EXIT       && i want go to the finally
 ENDDO
 ? 'try'
 THROW
CATCH
 ? 'catched'
FINALLY
 ? 'FINALLY'
ENDTRY
I can found a simple, but annoying, workaround:
a variable
LOCAL exitTry
and many
...
IF m.exitTry
 EXIT
ENDIF
...
Cut multilevel block, It is a not good programming techinique,
but VFP have a universal cut multilevel procedure blocks and loops block command:
RETURN TO ProcedureName
***********

For me EXIT name is a bad choice.
Best has EXITBLOCK, or other specific name.

Problem:
it has been chosen with a scope or because it is the first thought simple name?

Fabio
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform