Contents / Structure within BASIC / Previous chapter / Next chapter / Index


Structure within BASIC


When building a house there are a number of options: one can chop trees down and tie them together to form a hut, one could use straw and mud if one had the skill to deal with those materials or one can use 'building, blocks' like windows, doors and bricks. Whichever materials one selects the planning and construction is made much easier if one has a clear understanding of the available structures.

The same type of argument applies when writing a computer program to solve a particular problem. A number of program structures are available and it is well worth while learning what each can do. If you are attempting a trivial job (making an orange box or adding up a set of numbers) then little or no planning is needed. On the other hand, building an extension to your house or writing a computer program to play a game does require planning if it is not going to 'crash' without warning. This planning will involve the use of a number of 'structures'.

Here are the main structures available on the BBC computer.

REPEAT...UNTIL

FOR...NEXT

IF...THEN...ELSE

PROCEDURES

FUNCTIONS

GOSUB

ON...GOTO

ON...GOSUB


14 REPEAT... UNTIL, TRUE and FALSE 87

15 FOR... NEXT 91

16 IF... THEN... ELSE 98

17 PROCEDURES 102

18 FUNCTIONS

19 GOSUB 113

20 GOTO, ON GOTO and ON GOSUB 118

Exit: BBC Microcomputer User Guide; Kasoft Typesetting; Archer


The BBC Microcomputer User Guide was written by John Coll and edited by David Allen for the British Broadcasting Corporation.

Optical character recognition and original formatting effort by Mark Usher.

HTML version maintained by: Kade "Archer" Hansson; e-mail: archer@dialix.com.au

Last updated: Monday 12th February 2001