LOGICAL Input: The L Descriptor
The Lw descriptor is used for LOGICAL input.
The general form of the Lw descriptor is as follows:
The meaning of r and w are:
- L is for LOGICAL
- w is the width of field, which indicates that
a LOGICAL value should be read in from the next
- In this w positions, the input should be in the
following form: It starts with any number of spaces, followed by
an optional period, followed by a T or
F, followed by anything. The following are
a few correct examples: .TRUE., TRUE, .TRUE,
T, .T, Ten, Tennessee,
.Ten dollars and .Ten. All of these input are
equivalent to .TRUE. The following are a few other
example, .FALSE., FALSE, .FALSE,
.F., F, Four, .Fourteen,
Florida, Fake, F.F.F. and
FALSE_AND_TRUE. All of these input are equivalent to
.FALSE. However, the following examples are all
incorrect: Not_True (does not start with a T)
and ..TRUE (starts with two periods).
- Consider the following example:
Suppose the input is the following:
LOGICAL :: a, b, c
READ(*,"(L3, L8, L10)") a, b, c
Variable a takes the first three positions, which contain
F, a and x. Thus, a receives .FALSE. since the
first character is a F. Variable b takes the next
8 positions, which contain two spaces, T, r, u, s, t and a space.
Since the first non-blank character is a T, b receives
.TRUE. Variable c takes the next 10 positions,
which contain two spaces, T, h, u, r, s, d, a and y. Therefore,
c also receives .TRUE.
1 1 2
Fax Trust Thursday
- If you system recognizes lower cases,
as many systems do, T and t are the same, and
F and f are the same.
- r is the repetition indicator, which gives
the number of times the edit descriptor should be repeated.
For example, 3L5 is equivalent to
L5, L5, L5.