Re: equivalent du goto sous windev

Posté par Zeth le 12/6/2009 15:32:56
bonjour,

voici un exemple d'utilisation extrait de l'aide de WD12 :

Res = fOuvre(NomFichier, foEcriture)
SI Res = -1 ALORS GOTO ERROUVRE
Res = fEcrit(Res,"Traitement OK")
SI Res = -1 ALORS GOTO ERRECRIT
...
RENVOYER Vrai
ERROUVRE :
Info("Le fichier "+NomFichier+" ne peut être ouvert. Vérifiez son existence.")
RENVOYER Faux
ERRECRIT :
Info("Il est impossible d'écrire dans le fichier "+NomFichier)
RENVOYER Faux

Personnellement je n'aime pas trop l'utilisation des GOTO ^^ On peux très bien s'en passer en utilisant de SI, SELON ... et des procédures/fonctions.

Cordialement, Zeth.

Cette contribution était de : http://old.wdforge.org/newbb/viewtopic.php?forum=20&topic_id=6217&post_id=24741