FORTRAN Reference Manual

Language Elements
FORTRAN Reference Manual528615-001
2-13
Logical Constants
Complex Constants
You express a complex constant as a pair of real or integer constants separated by a
comma and enclosed in parentheses:
( real, imaginary)
where real is a real or integer constant that specifies the real part, and imaginary a
real or integer constant that specifies the imaginary part. For example:
(1, 7.5)
(5, 1)
(-2.5E3, 3.67)
Logical Constants
There are two logical constants:
.TRUE.
.FALSE.
You must write the enclosing decimal points. A logical value is stored in one 16-bit
word. The LOGICAL*4 compiler directive provides doubleword logical values. The only
values used for logical constants are all bits set to 1 for .TRUE., and all bits set to for
.FALSE..
Character Constants
A character constant is a string of up to 255 characters enclosed in apostrophes ('). A
space character in a string occupies a position and is therefore significant. The
following is an example of a character constant:
'April 1985'
If the string contains an apostrophe, you must use two apostrophes to distinguish it
from the terminating apostrophe. The compiler treats two adjacent apostrophes as one
apostrophe.
'Mozart''s "Don Giovanni"'
'The ''customer'' is always right!'
The following character constants are invalid:
"Report Summary" <-- The constant is not enclosed in
apostrophes.
'Sam's Diner' <-- The inner apostrophe is not doubled.
Character constants are case sensitive—the compiler retains uppercase and
lowercase letters exactly as you specify them in the character constant.