This is another very useful structure because it is a choice of doing something or not; we call it a
simple binary decision. Its general form is:
IF condition THEN statement(s)
You will see later how the two concepts of repetition (or looping) and decision-making (or selection)
are the main structures for program control. You can stop the program by pressing the break keys:
hold down CTRL and then press the space bar.
SELF TEST ON CHAPTER 3
You can score a maximum of 13 points from the following test. Check your score with the answers on
Page 107 - in the "Answers to self test" section at the end of this Beginner's Guide.
1. What is a pixel?
2. How many pixels fit across the screen in the low resolution mode?
3. How many pixels fit from bottom to top in low resolution mode?
4. What are the two numbers which determine the 'address' or position of a graphics point
on the screen?
5. How many colours are available in the low resolution mode?
6. Name the keywords which do the following:
i. draw a line
ii. select a colour for drawing
iii. iii select a background colour
iv. draw a border (5 points)
7. What are the statements which open and close the REPeat loop?
8. When does an executing REPeat loop terminate?
9. Why do loops in SuperBASIC have names?
PROBLEMS ON CHAPTER 3
1. Write a program to draw straight lines all over the screen. The lines should be of random
length and direction. Each should start where the previous one finished and each should have
a randomly chosen colour.
2. Write a program to draw lines randomly with the restriction that each line has a random start
on the left hand edge of the screen.
3. Write a program to draw lines randomly with the restriction that the lines start at the same
point on the bottom edge of the screen.
4. Write a program to produce lines of random length, starting points and colour. All lines must
be horizontal.
5. As problem 4 but make the lines vertical.
6. Write a program to produce a square 'spiral' in such a way that each line makes a random
colour