Statement
Numbers
Unconditional
GO
TO
In a previous section of this
part
of
the
manual,
it
was
stated
that
you can
set
up
a
program
to perform a basic computation,
then
make
the
same computa-
tion
on
many
different values simply
by
changing
the
value of
the
subscripts.
This
kind
of operation is called "looping." You
would
use a control
statement
to
establish
the
number
of statements
that
are
to
be
included
in
the
basic computa-
tion to determine
how
many
times
the
loop is to
be
performed.
Control statements
that
direct
the
program
to
another
statement
in
the
pro-
gram
are
referred to
in
this
manual
as
program
transfer statements.
Whenever
you direct
the
program to a specific
statement
(other
than
the
next
sequential
statement),
the
statement
must
be
numbered
so
that
it
can
be
identi-
fied
by
the
processor.
On
the
FORTRAN
coding form,
the
first five columns are
reserved for statement numbers. A
statement
number
can
be
any
number
from
0001 to 9999
(leading
zeros are
not
required).
Statements
must
be
numbered
when
they
are
referenced
by
another
state-
ment
and
no two statements can have
the
same number. Also,
there
is
no require-
ment
that
every statement
must
have a number, nor
that
statements
must
be
numbered
in sequence.
It
is
possible to
number
every
statement
as
an aid
in
programming,
but
each
number
you assign requires positions of storage.
If
the
problem
being
programmed
is
very long
and
requires a large
amount
of storage,
you may
not
be
able to afford
the
luxury of
numbering
every statement.
This
statement
interrupts
the
sequential execution of statements,
and
specifies
the
number
of
the
next statement to
be
performed.
Format:
Example:
"GO
TO
n"
where
n is a
statement
number.
GO
TO
30
GO
TO
1000
An example is shown below:
!TATEMENT
NUMBER
FORTRAN STATEMENT
~
5 6 7
'0
'5
20
2S
30
35
45
50
55
•
,
1
f-.
,
I I
I
I
•
,
,
I I
I
I I
A=:4
I
I
B=
7 ,
GO
T,D
6
1.8
C:: 3 .
,,.,A
6
c=
3
.,~B
·
.i---"-~
~~.-
-~.
•
The
GO
TO
statement
transfers
the
program
to
statement
6
where
the
result
21
is obtained.
Writing the 1620
FORTRAN
Program 23