EasyManua.ls Logo

AMSTRAD cpc 6128 - Gobus

AMSTRAD cpc 6128
520 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
The
single quote
mark
' (which
can
be typed by holding down
[SHIFT]
and
pressing
the
7 key)
can
be used
as
a
substitute
for :
REM.
For example:
HI
I
Zap
the
i n v a d e r s
[RETURN]
20
L = 5 I nu m b e r 0 f l i ve s
[RETURN]
GOSUB
If
there
are
a
set
of instructions
within
a program which
are
to be carried out a
number
of
times,
these
instructions need not be typed
in
repeatedly every
time
they
are
needed
in
the
program; instead,
they
can
be
made into a 'sub-routine' which when
required,
can
be called into action by
the
command
GO
SUB
followed by
the
line
number. The end of
the
G 0
SUB
-routine is
marked
by
typing
in
the
instruction
RE
T
URN.
At
this
point
the
computer will
return
to
the
instruction
that
immediately
followed
the
GO
SUB
command which
it
had
just
obeyed.
For example,
in
the
following program:
10
a=2
20
PRINT
"here
is
the";a;"times
table"
30
FOR
b=1
TO
12
40
c=a*b
50
PRINT
a;"x";b;"=";c
60
NEXT
70
PRINT
80 I
90
a=5
100
PRINT
"here
is
the";a;"times
table"
110
FOR
b=1
TO
12
120 c=a*b
-
--
-1-3 0
-P
R I N T- a;-" x
";b-;
"=
" ; c----- -
---
--
--
--
140
NEXT
150
PRINT
160
170
180
190
200
210
220
230'
240
250
260
270
280
290
300
310
a=8
PRINT
"here
is
the";a;"times
FOR
b=1
TO
12
c=a*b
PRINT
a;"x";b;"=";c
NEXT
PRINT
I
a=9
PRINT
"here
is
the";a;"times
FOR
b=1
TO
12
c=a*b
PRINT
a;"x";b;"=";c
NEXT
PRINT
Foundation Course
table"
table"
Chapter 1 Page
31

Table of Contents

Related product manuals