This question already has an answer here:
- How to terminate a do loop? 2 answers
probably this is a trivial matter to most of you but it got me completely stuck. I have an IF block nested inside a DO loop; I need the loop to be interrupted in case the criteria stated in the IF block are not met. Here is my code:
IF ( con(i) .GT. 1 ) THEN
search_n1: DO j = 1, 10
IF ( CM(i,j) .EQ. 1 ) THEN
n2 = i
n1 = j
ELSE
CYCLE search_n1
END IF
END DO search_n1
ELSE
CYCLE
END IF
(where CM and con are arrays defined in a previous part of the code).
Aucun commentaire:
Enregistrer un commentaire