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

118 330 DATA CARNIVOROUS 340 DATA TENTERHOOK 350 DATA DECOMPRESSION 360 DATA FORTHCOMING 370 DATA NEVERTHELESS 380 DATA POLICEWOMAN. 390 DATA SOPHISTICATED 400 DATA GUESSTIMATE There are a number of improvements to be made to this program. Its screen layout is poor and also it lets you guess the same letter twice. It is possible to use some mathematical operators on strings. For example one can check to see if two strings are ‘equal’ or if one string is ‘greater’ than another. Obviously the words ‘equal’ and ‘greater’ have slightly different meanings when applied to strings. A few examples may help to clarify things.

As far as the computer is concerned, ‘XYZ’ is greater than ‘ABC’ because X is further down the alphabet than A. Similarly, ‘ABC’ is greater than ‘AB’ because ‘ABC’ is a longer string. You can use the following comparisons with strings: = equal to not equal to less than > greater than less than or equal to >= greater than or equal to The following are legal statements: IF A$ = "HELLO" THEN PRINT "HOW ARE YOU" IF B$ > "FIFTEEN" THEN GOTO 1000 Notice that if contained SIX it would be regarded as ‘greater than’ FIFTEEN because it starts with an S whereas FIFTEEN starts with an F .

10 B$ = "SIX" 20 IF B$ >"EIGHT" THEN STOP This program would stop because the word SIX begins with an S which is regarded as ‘greater than’ the letter E . Strings are compared character by character using ASCII codes. If two strings start with an identical sequence of letters, for example PIN and PINT then the longer string is regarded as the larger one.