mathmate
- 365
- 0
Here is an example, the output of the program is 5.0000, which correspond to what you'd like to do, I think.Urgent question::can I break a loop in subroutine by return statement, because when some condition is true I need to break the loop and go back to the point in the main program where I have called the subroutine
Code:
FUNCTION F1(n)
INTEGER n
DO 10 I=1,n
IF (I.GE.5) THEN
F1=I
RETURN
ENDIF
10 CONTINUE
F1=I
RETURN
END
PRINT *, F1(10)
STOP
END
