mmary of BASIC t< section lists some common BASIC words and describes what they e the computer do and how they are used. Most of them have beenused tihe programs in this book, so you can check back through the book tosee wthey work in a game. Notall the words can be used onallthe nputers mentioned in this book. The conversion chart on page 46 shows hat you can use instead. LET tells the computer to label a section ofits memory and put a particular value in it e.g. LET A —6 means label a section of memory "A" and put the value 6init. "A" is calledaa "variable" and putting something in 1t is called "assigning aa valuetoa variable". Some variable labels are followed by a dollar sign e.g. A$. This means they are for "strings", which can contain any number of characters, including letters, numbers and symbols. PRINT tells the computer to display things onthe screen and you can use it in several ways: A message enclosed in guotation marks with PRINT nn front of it will be displayed on the screen exactly as you typed it. The section inside guotes does not have to be in BASIC, it can be anythingyou lke. PRINT followed by a variable label e.g. PRINTA or PRINT A$tells the computer to display the 3 contents of that variable on the screen. PRINT can also do calculations and then display the results e.g. PRINT 6" 4 will make the computer display 24. You can use PRINT by itself to leave an empty hne. RND tells the computer to choose a numberat random. Different computers use different formsoof RND and you can see what these are inthe conversion chart on page 46. On Sinclair computers | RND by itself produces a number between0 and b), 99999999, You can vary the limits of the numberit chooses by multiplying RND and adding to tt. E.g. RND"20 produces a number between 0and 19.99999999, while RND"'20-- 1 produces a number between | and 20.99999999. See INT for how to produce only whole numbers. See CHR$ for how to produce letters and other keyboard characters at random. ga KT AM Z] INT is short for integer, which means whole number. For positive numbers, tt tells the computer to ignore everything to the right of the decimal point. E.g. INT(20.999) is 20. For negative numbers, it ignores everything to the right of the decimal point and "increases" the number to the left of it by one e.g. INT(— 3.6) is —4. INT is often used with RND, like this: INT(RND"20 1 1) which tells the computer you want it to choose a whole number between | and20. CHR$ converts numbers into letters. Apart fromthe ZX81, all the computers in this book use the ASCII" set of keyboard characters in whicheach character corresponds to a certain number. E.g. letter A has the code number 65 and PRINT CHR$(65) will display an A on the screen. You can use CHR$ with INT and RND to make the computer select random letters, like this: CHR$(INT(RND"26 --65)) This line will produce random letters on a ZX Spectrum (see conversion chart for other computers). FOR is used to starta "loop" which will makethe computer repeat part of a program a certain number of times. It must be followed by a variable in a game), and the variable must be given startand end values (suchas 1] TO 10.) The end of the loop is marked by a NEXT line (NEXT G in this example) which increases the value ofthe variable by l each time and then sendsthe computer back to the FOR hne again. Whenthe variable reaches its end value, the computer ignores the NEXT line and carries on to the line which follows it. Every FOR must have a NEXTor you will get a bug. INPUT labels a space in the computer's memory, prints a guestion mark and then waits for youto type something which it can put in thismemory space. It will not carry on with the rest ofthe program until you press RETURN, ENTERor NEWLINE. | You can use number or string variables with INPUT, but if you use a number variablethe computer will not accept letters from you. « American Standard Code for Information In terchange (see page 45) -— —