EasyManua.ls Logo

AMSTRAD CPC464 - 4 Variables, operators and data; 4.1 Spot the reserved word

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 Variables, operators and
data
Handling the information in a BASIC program
Subjects covered in this chapter:
* Getting familiar
* Variable types : real, integer and string
* Operators, logical expressions
* Arrays
* DATA
4.1 Spot the reserved word
Note (if you havent already) that the commands and other reserved words in AMSTRAD BASIC are
delimited, either by spaces or punctuation marks, numeric operators etc. Programs are easier to read
and debug, because although you may enter the keywords either in UPPER CASE or lower case -
when the program is LISTed, all keywords have been converted to UPPER CASE anyway. If they
havent then there is an error concerning the way they have been typed in, and the program will not
run.
AMSTRAD BASIC allows you to imbed keywords into variable names. A variable in AMSTRAD
BASIC is a name that you assign to a specific element. It can be as simple as a single letter
(variables must always start with a letter - not a number), although its easier to read and
understand a long program if you use variable names that reflect whats going on:
ANSWER=4*4: print ANSWER
Variables in AMSTRAD BASIC may contain up to 40 characters (the first must be a letter), and all
40 are significant. Variables must not contain any spaces - or BASIC will only read the letters (or
letters and numbers) up to the first space and then respond with:
Syntax error
Which is indicating that an illegal sequence of characters has been entered (see Appendix VIII). If
you want to include phrases with words separated, then use a full stop . where you would otherwise
have left a space. All the usual forms of subscripted variables are possible, bearing in mind the need
to DIMension arrays.

Table of Contents

Other manuals for AMSTRAD CPC464

Related product manuals