SECTION B FILE INTRO.B LINE NUMBERS AND COMMAND LINES ****************************** The program you have just been working with is a simple example of a BASIC program. I hope that you have spent a little time with it and used the LIST command to reveal how BASIC looks when written. There is no need at all for the present to attempt to understand how it works, but having seen it we can start to find out how a BASIC program is put together. If you are new to computer programming you may find some of the following difficult to understand straight away. Just read it through carefully, and as you carry on with the course you will find that everything will fall into place. LINE NUMBERS MALLARD BASIC is written in lines, each of which ============ commence with a number (not all BASICs do). The lowest possible line number is 0, the largest 65534. A very common way to number program lines is to start at ten and then number in increments of 10 ie 10,20,30,40 etc. Doing this allows extra lines to be inserted if required. Lines may be entered in any order and at the first opportunity BASIC will put them in numerical order. If, for example, an extra line was required between lines 20 and 30, you would give it an intermediate number, say 23, and BASIC would pop it into it's correct numerical niche. When writing a long program it is often convenient to make it up of a number of short programs or 'modules'. Each module can be well separated numerically , say starting each module 1000 apart, and in addition these modules can be written in any order, provided the line numbers reflect their true place in the program. BASIC will sort this out and place each line in it's correct numerical position. When the program is complete BASIC allows you, if you wish, to renumber the program for neatness, using the command RENUM. Where one line refers to another, RENUM will take care of this too, provided certain rules are kept. This is how programs in magazines are always numbered so neatly. Only the author will know how many lines he had to insert to make the program work. A program line cannot consist of a number on it's own, as BASIC will not recognise it. You will see later that this is a way of cancelling a line of programming. COMMAND LINES After the line number comes the instruction to the ============= computer, telling it what to do. Writing these instructions so as to make the computer do as you wish is, of course, what programming is all about. When you have written a program line, and are happy with it, you press [RETURN] to fix the line in memory and to prepare the computer to receive the next line. Lines can contain a maximum of 255 characters including numbers, letters, spaces, symbols and punctuation marks; if you attempt to exceed this the computer will not accept it and will beep furiously. Many instructions can be grouped on one line if required. Long lines generally use less memory, but this is seldom very important and too many long lines make a program tedious to write and understand. As with many aspects of programming, line length is a question of individual preference and style End of file INTRO.B cts of programming, line length is a question of