This function detects the first position of an integer value of kind long_k in an array. When there is no match the return value is 0.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=long_k), | intent(in) | :: | long | |||
integer(kind=long_k), | intent(in) | :: | array(:) |
pure function tem_posOfLong( long, array ) result( pos ) ! --------------------------------------------------------------------------- integer(kind=long_k), intent(in) :: long integer(kind=long_k), intent(in) :: array(:) integer :: pos ! --------------------------------------------------------------------------- integer :: iEntry ! --------------------------------------------------------------------------- do iEntry = 1, size(array) if( long == array(iEntry))then pos = iEntry return end if end do pos = 0 end function tem_posOfLong