RECURSIVE

Keyword: Specifies that a subroutine or function can call itself directly or indirectly. Recursion is permitted if the keyword is specified in a FUNCTION or SUBROUTINE statement, or if RECURSIVE is specified as a compiler option or in an OPTIONS statement.

説明

If a function is directly recursive and array valued, the keywords RECURSIVE and RESULT must both be specified in the FUNCTION statement.

The procedure interface is explicit within the subprogram in the following cases:

The keyword RECURSIVE must be specified if any of the following applies (directly or indirectly):

 ! 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

関連情報


このヘルプトピックについてのフィードバックを送信

© 1996-2011 Intel Corporation. 無断での引用、転載を禁じます。