02.05.2014 Views

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Les itérations 71<br />

5.2 – Les itérations<br />

5.2.1 – L’instruction GOTO<br />

L’instruction GOTO permet d’effectuer un branchement<br />

à un endroit particulier du code :<br />

GOTO étiquette<br />

Cette instruction est à éviter car elle peut générer des<br />

programmes illisibles et difficiles à corriger.<br />

Exemple<br />

PROGRAM iteration_goto<br />

REAL diviseur, valeur, facteur<br />

...<br />

valeur = 0. ; diviseur = 360.<br />

69 IF (diviseur .NE. 0.) THEN<br />

valeur = valeur + facteur / diviseur<br />

diviseur = diviseur - 10.<br />

GOTO 69<br />

END IF<br />

...<br />

END PROGRAM iteration_goto<br />

Cet exemple peut être remplacé par une boucle itérative<br />

de type DO WHILE.<br />

INSTITUT DU DÉVELOPPEMENT<br />

ET DES RESSOURCES<br />

EN INFORMATIQUE SCIENTIFIQUE<br />

Cours langage Fortran – 27 janvier 2006<br />

<strong>Patrick</strong> <strong>Corde</strong> et <strong>Anne</strong> <strong>Fouilloux</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!