Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FORTRAN and recursion: The FORTRAN language evolved from FORTRAN-I thr

Status
Not open for further replies.
Apr 18, 2001
1
0
0
US
FORTRAN and recursion: The FORTRAN language evolved from FORTRAN-I through FORTRAN-90, and beyond. Why do you think the FORTRAN language did not support recursion until FORTRAN-90? In your answer, take into consideration the power of recursion, and methods of its implementation.
 
Fortran-90 have implemented recursive subroutine as a standard. Below is example from Digital visual fortran 5.0.

! RECURS.F90
!
i = 0
CALL Inc (i)
END

RECURSIVE SUBROUTINE Inc (i)
i = i + 1
CALL Out (i)
IF (i.LT.20) CALL Inc (i) ! This also works in OUT
END SUBROUTINE Inc

SUBROUTINE Out (i)
WRITE (*,*) i
END SUBROUTINE Out

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top