EasyManuals Logo

Sinclair QL Beginner's Guide

Sinclair QL
135 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #44 background imageLoading...
Page #44 background image
Assuming that the procedure square is still present at line 200 then the following program
will have the classical effect.
100 REMark Squares Pattern
110 PAPER 7 : CLS
120 FOR pair = 1 TO 20
130 INK RND(5)
140 LET side = RND(10 TO 20)
150 LET ac = RND(50) : up = RND(70)
160 square side,ac,up
170 LET ac=ac+side/5 : up = up+side/5
180 square side,ac,up
190 END FOR pair
The advantages of procedures are:
1. You can use the same code more than once in the same program or in others.
2. You can break down a task into sub-tasks and write procedures for each sub-task. This helps
the analysis and design.
3. Procedures can be tested separately. This helps the testing and debugging.
4. Meaningful procedure names and clearly defined beginnings and ends help to make a
program readable.
When you get used to properly named procedures with good parameter facilities, you should find that
your problem-solving and programming powers are greatly enhanced.
SELF TEST ON CHAPTER 7
You can score a maximum of 14 points from the following test. Check your score with the "Answers
To Self Tests" section at the back of this Beginner's Guide.
1. How do we normally tackle the problem of great size and complexity in human affairs?
2. How can this principle be applied in programming?
3. What are the two most obvious features of a simple procedure definition? (two points)
4. What are the two main effects of using a procedure name to 'call' the procedure? (two points)
5. What is the advantage of using procedure names in a main program before the procedure
definitions are written?
6. What is the advantage of writing a procedure definition before using its name in a main program?
7. How can the use of procedures help a 'thirty-line-programmer' to write much bigger programs?

Other manuals for Sinclair QL

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Sinclair QL and is the answer not in the manual?

Sinclair QL Specifications

General IconGeneral
ProcessorMotorola 68008
Clock Speed7.5 MHz
RAM128 KB (expandable to 640 KB)
ROM48 KB
Operating SystemSinclair QDOS
Release Year1984
StorageMicrodrive tape loop
Graphics256x256 pixels, 8 colors
PortsRS-232, ROM cartridge
SoundBeeper (internal speaker)

Related product manuals