02.05.2014 Views

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Les itérations 78<br />

Instruction CYCLE<br />

bloc i peut aussi contenir une instruction CYCLE :<br />

IF (expression) CYCLE<br />

CYCLE permet d’abandonner le traitement de l’itération<br />

courante et de passer à la suivante.<br />

Là aussi, l’instruction IF peut être remplacée par une<br />

instruction de type SELECT CASE.<br />

Exemple<br />

PROGRAM iteration_cycle<br />

INTEGER :: annee<br />

DO<br />

READ(*,*) annee<br />

IF (annee .LE. 0) EXIT<br />

! On élimine les années bissextiles.<br />

IF( ((annee/4*4 .EQ. annee) .AND. &<br />

(annee/100*100 .NE. annee)) .OR. &<br />

(annee/400*400 .EQ. annee) ) CYCLE<br />

PRINT*,’Traitement des années non-bissextiles’<br />

...<br />

END DO<br />

END PROGRAM iteration_cycle<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!