Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF (EN)

19 MY and AGE . There are only four restrictions about the names that we give to variables: 1. There must be no spaces in the middle of a variable name. 2. All variable names must start with a letter – however you can add in as many numbers as you want to later on. 3. You must not use punctuation marks (such as exclamation marks and question marks) in the variable name but you can use an underline character. 4. Variable names should not begin with BASIC keywords like PRINT and LET . One that is particularly easy to use by mistake is the keyword TO . However it is permissible to start a variable name with a lower case ‘to’ because upper and lower case names are different.

There is a full list of keywords in chapter 48 and they are described in detail in chapter 33. To get lower case characters on the screen, make sure that the CAPS LOCK is off by depressing it to turn off its light. Now you will get small letters and numbers. Hold the SHIFT key down if you want to use capital with lower case letters. Any of the following variable names are acceptable. LET AGE=38 LET this year=1984 LET lengthOFrod=18 LET CAR_mileage=13280 LET value5=16.1 LET weight4=0.00135 LET chicken2egg3=51.6 However the following variable names are illegal.

LET Football Result=3 (There’s a space.) LET Who?=6 (There’s a question mark.) LET 4thvalue=16.3 (Starts with a number.) LET TODAY=23 (Starts with TO.) LET PRINT=1234.56 (PRINT is a reserved word.) You will notice that in all the examples above we have put the word LET before the variable name. That gives a clear indication of what is actually happening inside the computer, namely that the numeric variable this _ year, in one of the examples, is being given a new value ‘1984’. The word LET is optional and the computer will also accept this_year=1984 This shortened version is more frequently used.