Subscripts
16
or
ID
=
IR
t.'
IT
or,
better
yet
IDIST
=
IRATE
*
ITIME
Variables
can
be
written
in
a
meaningful
manner
by
using
an
initial charactel
to
indicate
whether
the
variable
is fixed
point
or
floating
paint
and
by
using
succeeding characters as
an
aid
to memory.
Another aid to
programming
FORTRAN
is
to vary
the
last
character
of a variable
name.
For
example, to
compute
four different quantities called
HRS,
you could use
the
following:
HRS 1
HRS 2
HRS
.3
HRS 4
If
the
values
of
these variables were in fixed point, you could
precede
each
of
these names
by
I,
J,
K,
L, M, or
N.
The
rules for
naming
and
forming variables
and
constants
might
be
easier to
understand
if you know
how
the
processor uses
the
names
that
you assign.
When
you
establish a
name
for a
constant
or
variable,
the
processor establishes for
the
object
program
a specific location in storage
that
will contain
the
data
that
you
have
named.
Whenever
this
name
appears in
the
object program, you are, in effect,
telling
the
program
to go to
the
position in core storage
where
the
data, repre-
sented
by
its name,
is
stored, in
order
to perform a calculation
with
the
data.
Thus,
each
constant
and
variable
that
you use is assigned a location in 1620
storage
where
its value
is
located. Therefore
it
is
important
that
you remember:
l.
When
you are forming a constant, do
not
use more
than
4 digits
if
it
is
a
fixed
point
number,
and
be
certain to use a decimal
if
it
is
a floating point
number.
2.
When
you are
naming
a variable, use one of
the
letters I
through
N as
the
first
character
if
the
value
is
a fixed point
number,
and
do
not
use
the
letters
I
through
N
if
it
is a floating
point
number.
3.
Do
not
assign
the
same
name
to more
than
one
variable.
4.
Be certain
that
data
is
in
the
same
mode
(fixed
point
or
floating
point)
as its variable
name
indicates it should be.
Variables
in
your
program
can
be
subscripted
so
that
you
can
represent
many
quantities
with
one
variable name.
In
an
earlier example, four different quantities
called
HRS
were
named
HRS
1,
HRS
2,
HRS
3,
and
HRS
4.
If
a
program
contained 50
quantities for
HRS,
it
would
be
cumbersome
and
time consuming to
name
all of
them
in
this manner.
A
group
of 50 such
quantities
can
be
referred
to as
an
"array." Rather
than
name
all 50 quantities
in
the
array,
it
is
much
easier to
refer
to
the
entire array
by
one
name
and
refer to
each
individual
quantity
(element)
in
the
array
in
terms of
its place
in
the
array.