The ANY function determines whether any values in a logical mask are true either for an entire mask or along a given dimension of the mask.
SyntaxANY (mask [, dim])
mask is an INTENT(IN) array of type LOGICAL. It must not be scalar.
dim is an INTENT(IN) scalar INTEGER with a value within the range
The result is of type LOGICAL and the same kind as MASK. Its value and rank are determined as follows:
Example 1real,dimension(4) :: q=(/1.,-2.,3.,4./) write(*,*) any(q < 0.) ! writes T
Example 2integer, dimension (2,3) :: a, b a = reshape((/1,2,3,4,5,6/), (/2,3/)) write(*,'(2i3)') a ! writes 1 2 ! 3 4 ! 5 6 b = reshape((/1,2,3,5,6,4/), (/2,3/)) write(*,'(2i3)') b ! writes 1 2 ! 3 4 ! 5 6 write(*,*) any(a==b) ! writes T write(*,*) any(a==b, 1) ! writes T T F write(*,*) any(a==b, 2) ! writes T T