]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/doc/gfortran/intrinsic-procedures/and.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / and.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 .. _and:
7
8 AND --- Bitwise logical AND
9 ***************************
10
11 .. index:: AND, bitwise logical and, logical and, bitwise
12
13 .. function:: AND(I, J)
14
15 Bitwise logical ``AND``.
16
17 :param I:
18 The type shall be either a scalar ``INTEGER``
19 type or a scalar ``LOGICAL`` type or a boz-literal-constant.
20
21 :param J:
22 The type shall be the same as the type of :samp:`{I}` or
23 a boz-literal-constant. :samp:`{I}` and :samp:`{J}` shall not both be
24 boz-literal-constants. If either :samp:`{I}` or :samp:`{J}` is a
25 boz-literal-constant, then the other argument must be a scalar ``INTEGER``.
26
27 :return:
28 The return type is either a scalar ``INTEGER`` or a scalar
29 ``LOGICAL``. If the kind type parameters differ, then the
30 smaller kind type is implicitly converted to larger kind, and the
31 return has the larger kind. A boz-literal-constant is
32 converted to an ``INTEGER`` with the kind type parameter of
33 the other argument as-if a call to :ref:`INT` occurred.
34
35 Standard:
36 GNU extension
37
38 Class:
39 Function
40
41 Syntax:
42 .. code-block:: fortran
43
44 RESULT = AND(I, J)
45
46 Example:
47 .. code-block:: fortran
48
49 PROGRAM test_and
50 LOGICAL :: T = .TRUE., F = .FALSE.
51 INTEGER :: a, b
52 DATA a / Z'F' /, b / Z'3' /
53
54 WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F)
55 WRITE (*,*) AND(a, b)
56 END PROGRAM
57
58 See also:
59 Fortran 95 elemental function:
60 :ref:`IAND`