]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/doc/gfortran/intrinsic-procedures/or.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / or.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 .. _or:
7
8 OR --- Bitwise logical OR
9 *************************
10
11 .. index:: OR, bitwise logical or, logical or, bitwise
12
13 .. function:: OR(I, J)
14
15 Bitwise logical ``OR``.
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}` and :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 = OR(I, J)
45
46 Example:
47 .. code-block:: fortran
48
49 PROGRAM test_or
50 LOGICAL :: T = .TRUE., F = .FALSE.
51 INTEGER :: a, b
52 DATA a / Z'F' /, b / Z'3' /
53
54 WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
55 WRITE (*,*) OR(a, b)
56 END PROGRAM
57
58 See also:
59 Fortran 95 elemental function:
60 :ref:`IOR`