4.2 Short cuts
It’s tedious typing
every time, so you can use a
?
instead, and BASIC will understand this
means
(so long as it is not placed inside any phrase within quotation marks
“”
). Note that
the
?
option does not require to be de-limited using a space like the word
PRIN T
.
If you write the
line as a program rather than a direct command:
10?4*4
run
The answer is still the same, but now
LIST
this one-line program and as if by magic.....
list
1 0 PRINT 4*4
BASIC has also inserted a space before expanding the question mark. In
statements that
use quotation marks....
10?"HELLO"
You may also get lazy and drop the final quote marks ” on a line, as evidenced by the small
[CTRL][ENTER]
shorthand cassette load and run routine which prints
RUN”
on the screen. The
same works in program lines, but it’s not a good habit to get into, since if you subsequently go back
to the line and add to it, you will probably forget to close the quotes again.
4.3 Multi-statement lines and Mixed calculations
You can perform a number of operations on a single line of BASIC - in fact, as many as you like up to
the maximum line length of 255 characters. As usual, statements should be separated by colons
:
?2*8/5+5-4*777E9/3
returns..
. . . . . .
-1.036E+12
However, it is essential to understand the order in which the various mathematical operators (+ - * /
MO D etc) are recognised by BASIC, or you will make fundamental mistakes. They are:
Exponentiation - raising a number to a given power of 10.
MOD
Modulus - The remainder after Integer division.
-
Unary Minus (the minus sign used to declare a number as negative)
Multiply
/
Divide
\
Integer division: the result is shortened to give the whole number part of the
result, the decimal part is discarded by BASIC.
+
Addition
-
Subtraction
Содержание CPC464
Страница 1: ......
Страница 32: ...or you can type 3e1 1e1 ENTER 300 2 3000x1000 Type 3e3 1e3 ENTER 3000000 3 3000x0 001 Type 3e3 1e 3 ENTER 3 ...
Страница 102: ...PRINT 10 AND 12 Results in 8 PRINT 10 AND 1000 Results in 8 again ...
Страница 118: ...TO DO DRAW THIS PAGE ...
Страница 219: ...actual value may be made to vary during the execution of a program ...
Страница 240: ...Text and WINDOW planner Mode 2 80 Columns ...
Страница 241: ......
Страница 245: ...Sound envelope Music planner sheet ...