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
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