LOGICAL type
Standard: (F77) F90 F95 F2003 F2008 Example program
<Syntax>
LOGICAL [ ( [ KIND= ] expression ) ]
The expression must be a scalar integer whose value identifies a valid kind of logical.
LOGICAL*1
LOGICAL*2
LOGICAL*4
LOGICAL*8
<Semantics>
LOGICAL declares entities (variables, functions, etc.) to have logical values.
Logical values are either .TRUE. or .FALSE..
The KIND number determines the representation (storage space used);
The F90_KIND module contains named constants BYTE, TWOBYTE, WORD and LOGICAL64 which are convenient for specifying logical types with a particular storage.
The actual kind numbers used depend on whether “sequential”, “byte” or “unique” kind numbering is being used.
Sequential Kind Numbering (default)
| KIND | 1 | 2 | 3 | 4 |
| Name | BYTE | TWOBYTE | WORD | LOGICAL64 |
| Storage size | 8 bits | 16 bits | 32 bits | 64 bits |
Byte Kind Numbering (-kind=byte option)
| KIND | 1 | 2 | 4 | 8 |
| Name | BYTE | TWOBYTE | WORD | LOGICAL64 |
| Storage size | 8 bits | 16 bits | 32 bits | 64 bits |
Unique Kind Numbering (-kind=unique option)
| KIND | 201 | 202 | 203 | 204 |
| Name | BYTE | TWOBYTE | WORD | LOGICAL64 |
| Storage size | 8 bits | 16 bits | 32 bits | 64 bits |
LOGICAL*1, LOGICAL*2, LOGICAL*4 and LOGICAL*8 are synonyms for LOGICAL(BYTE), LOGICAL(TWOBYTE), LOGICAL(WORD) and LOGICAL(LOGICAL64) respectively.
These synonyms are not standard Fortran.
<Related>
CHARACTER type, COMPLEX type, Component Definition statement, IMPLICIT statement, INTEGER type, KIND intrinsic function, LOGICAL intrinsic function, REAL type, Type Declaration statement