Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TRY/CATCH question
Message
De
18/01/2010 12:54:53
 
 
À
18/01/2010 11:56:35
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01444571
Message ID:
01444585
Vues:
74
>I am fairly new to TRY/CATCH, since I just started using VFP 9 fairly recently, for some clients.
>
>Now, my question is, why can't I do a RETURN from within the CATCH clause? I already found a workaround, just set a variable and then conditionally exit. But I was wondering about the reason - just hoping to get a more profound understanding of the relevant aspects. So, why would VFP not allow the RETURN directly from the CATCH clause?
>
>(Now that I am asking this, I am starting to think it might be related with the need to inconditionally execute the FINALLY clause - which I don't happen to have in this particular case. Can somebody confirm this?)

Because FINALLY it is executed on every case,
so a return within the block leads to a confusing programming
TRY
	EXIT
FINALLY
	MESSAGEBOX("finally 1")
ENDTRY

TRY
	=1='a'
CATCH
	MESSAGEBOX("catch 2")
FINALLY
	MESSAGEBOX("finally 2")
ENDTRY
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform