Lahey/Fujitsu Fortran

LOGICAL Function

Description

The LOGICAL function converts between different kinds of data type LOGICAL.

Syntax

LOGICAL ( l [, kind])

Required Arguments

l is an INTENT(IN) scalar or array of type LOGICAL.

Optional Arguments

kind is INTENT(IN) and determines the kind of the result. It must be a scalar INTEGER expression that can be evaluated at compile time.

Result

If kind is present, the result is of that kind; otherwise it is of default LOGICAL kind.

The result value is true if l is true and false if l is false.

Example

logical(kind=1) :: l1 ! not a portable declaration logical(kind=2) :: l2 ! not a portable declaration logical :: l4=.false. write(*,*) logical(l4,kind(l1)) ! writes F write(*,*) logical(l4,kind(l2)) ! writes F