40 LET third$ = CHR$(RND(65 TO 67))
50 LET word$ = first$ & second$ & third$
60 PRINT ! word$ !
70 IF word$ = "CAB" THEN EXIT taxi
80 END REPeat taxi
Random characters, like random numbers or random points are useful for learning to program. You
can easily get interesting effects for program examples and exercises.
Note the effect the ! … ! have on the spacing of the output.
SELF TEST ON CHAPTER 4
You can score a maximum of 10 points from the following test. Check your score with the answers in
the "Answers To Self Tests" section at the end of this Beginner's Guide.
1. What is a character string?
2. What is the usual abbreviation of the term, 'character string'?
3. What distinguishes the name of a string variable?
4. How do some people pronounce a word such as 'word$'?
5. What keyword is used to find the number of characters in a string?
6. What symbol is used to join two strings?
7. Spaces can be part of a string. How are the limits of a string defined?
8. When a statement such as:
LET meat$ = "steak"
is executed, are the quotes stored?
9. What function will turn a suitable code number into a letter?
10. How can you generate random upper case letters?
PROBLEMS ON CHAPTER 4
1. Store the words 'Good' and 'day' in two separate variables. Use a LET statement to join the
values of the two variables in a third variable. Print the result.
2. Store the following words in four separate pigeon holes:
light let be there
Join the words to make a sentence adding spaces and a full stop. Store the whole sentence in a
variable, sent$, and print the sentence and the total number of characters it contains.
3. Write a program which uses the keywords:
CHR$ RND(65 TO 90))
to generate one hundred random three letter words. See if you have accidentally generated any
real English words. Test the effects of: