EasyManua.ls Logo

AMSTRAD CPC464 - 4.3 Multi-statement lines and Mixed calculations

AMSTRAD CPC464
249 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...
4.2 Short cuts
Its tedious typing PRINT every time, so you can use a ? instead, and BASIC will understand this
means PRINT (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 PRINT. 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
10 PRINT 4*4
BASIC has also inserted a space before expanding the question mark. In PRINT 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 its 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

Table of Contents

Other manuals for AMSTRAD CPC464

Related product manuals