	FUNCTION pythagoras(a, b) 	! The enclosing function
	IMPLICIT NONE

	REAL pythagoras
	REAL a, b

	REAL s

	s = square(a) + square(b)
	pythagoras = sqrt(s)
	RETURN

	CONTAINS 		! internal function follow... 

	   FUNCTION square(a)

	   REAL square
	   REAL a

	   square = a*a
	   return
	   END FUNCTION 	!! END "FUNCTION" is required

	END FUNCTION pythagoras !! END required, FUNCTION is optional

! ================================================================

	PROGRAM internal
	IMPLICIT NONE

	REAL :: x
	REAL, EXTERNAL :: pythagoras

	x = pythagoras(3.0, 4.0)
	PRINT *, "X = ", x

!	x = square(3.0)		!! Error: cannot call internal function

	END
	
