Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29341 Discussions

modifying IF/SELECTCASE control variable inside IF/SELECTCASE block

forall
Beginner
673 Views
are there any rules/conventions regarding modifying the variable controlling the IF/SELECTCASE branching, eg,

IF(i==1)THEN
... (some codeA)
i=2
ELSEIF(i==2)THEN
... (some codeB)
i=10
ENDIF
nextstatement

I would expect this to be legal and, since Fortran doesnt have the fall-through of C (thankfully), after the branch with codeA is executed, the control is transfered to "nextstatement", even though i=2 satisfies the next ELSEIF condition.

and similarly for a SELECTCASE construct.
0 Kudos
1 Reply
Steven_L_Intel1
Employee
673 Views
I think that's ok.
0 Kudos
Reply