]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/doc/gfortran/intrinsic-procedures/all.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / all.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. _all:
7
8 ALL --- All values in MASK along DIM are true
9 **********************************************
10
11 .. index:: ALL, array, apply condition, array, condition testing
12
13 .. function:: ALL(MASK, DIM)
14
15 ``ALL(MASK [, DIM])`` determines if all the values are true in :samp:`{MASK}`
16 in the array along dimension :samp:`{DIM}`.
17
18 :param MASK:
19 The type of the argument shall be ``LOGICAL`` and
20 it shall not be scalar.
21
22 :param DIM:
23 (Optional) :samp:`{DIM}` shall be a scalar integer
24 with a value that lies between one and the rank of :samp:`{MASK}`.
25
26 :return:
27 ``ALL(MASK)`` returns a scalar value of type ``LOGICAL`` where
28 the kind type parameter is the same as the kind type parameter of
29 :samp:`{MASK}`. If :samp:`{DIM}` is present, then ``ALL(MASK, DIM)`` returns
30 an array with the rank of :samp:`{MASK}` minus 1. The shape is determined from
31 the shape of :samp:`{MASK}` where the :samp:`{DIM}` dimension is elided.
32
33 Standard:
34 Fortran 90 and later
35
36 Class:
37 Transformational function
38
39 Syntax:
40 .. code-block:: fortran
41
42 RESULT = ALL(MASK [, DIM])
43
44 Example:
45 .. code-block:: fortran
46
47 program test_all
48 logical l
49 l = all((/.true., .true., .true./))
50 print *, l
51 call section
52 contains
53 subroutine section
54 integer a(2,3), b(2,3)
55 a = 1
56 b = 1
57 b(2,2) = 2
58 print *, all(a .eq. b, 1)
59 print *, all(a .eq. b, 2)
60 end subroutine section
61 end program test_all