Experiment
#7
Changing a Phrase
It
is possible
to
move a word or even a phrase from one place in your program
to
another with the Editor. This can be very useful when you want
to
add a line, or a
portion of a line to another line.
List the last program
to
confirm that
it
is:
10
INPUT
"NUMBER";
N
20
IF
N=0
THEN
GOTO
60
30
AV
=
AV
+ N
£10
CT
=
CT
+ 1
50
GOTO
10
60
PRINT
"AVERAGE
IS";
AV/CT
The statement in line 40 will be placed in line 20, and line 40 eliminated. The revised
program will be
as
follows:
10
INPUT
"NUMBER";
N
20
IF
N=0
THEN
GOTO
60
ELSE
CT
=
CT
+ 1
30
AV
=
AV
+ N
50
GOTO
10
60
PRINT
"AVERAGE
IS";
AV/CT
Enter the EDIT command.
The program will be displayed
as:
10
INPUT "NUMBER";
N~
20
IF
N = 0
THEN
GOTO
604
31~~
t;V
"'"
l'lV +
l"i·~
'+0
CT
:::::
CT
-+
1<4
::~i(21
GOfO
:l
6~
PRIN'r
IIAVERA(3E
IS
1i
;
AV/
First the word ELSE will be added to line 20. Position the cursor
in
line 20 over the
carriage return character. Line 20 should appear
as:
20
IF
N =
(2)
THEN
GOTO
6~~
The cursor
is
now positioned for the insertion
of
the word ELSE. Type a space and
then the word ELSE. Line 20 should appear
as
20
IF
N =
(2)
THEN
GOT
a
60
ELSE.
Next, the statement
in
line 40 must be inserted after the word ELSE in line 20. This
is
accomplished
as
follows: Position the cursor
in
line 40
as
follows
'"
cr
+.
:l
81