Next: , Previous: ALARM, Up: Intrinsic Procedures


9.13 ALL — All values in MASK along DIM are true

Description:
ALL(MASK [, DIM]) determines if all the values are true in MASK in the array along dimension DIM.
Standard:
Fortran 95 and later
Class:
Transformational function
Syntax:
RESULT = ALL(MASK [, DIM])
Arguments:

MASK The type of the argument shall be LOGICAL and it shall not be scalar.
DIM (Optional) DIM shall be a scalar integer with a value that lies between one and the rank of MASK.

Return value:
ALL(MASK) returns a scalar value of type LOGICAL where the kind type parameter is the same as the kind type parameter of MASK. If DIM is present, then ALL(MASK, DIM) returns an array with the rank of MASK minus 1. The shape is determined from the shape of MASK where the DIM dimension is elided.
(A)
ALL(MASK) is true if all elements of MASK are true. It also is true if MASK has zero size; otherwise, it is false.
(B)
If the rank of MASK is one, then ALL(MASK,DIM) is equivalent to ALL(MASK). If the rank is greater than one, then ALL(MASK,DIM) is determined by applying ALL to the array sections.

Example:
          program test_all
            logical l
            l = all((/.true., .true., .true./))
            print *, l
            call section
            contains
              subroutine section
                integer a(2,3), b(2,3)
                a = 1
                b = 1
                b(2,2) = 2
                print *, all(a .eq. b, 1)
                print *, all(a .eq. b, 2)
              end subroutine section
          end program test_all