SECTION C - PRIMER FILE PRIMER.C VARIABLES ********* Variables are one of the features in any computer language which makes it so powerful. We use the term 'VARIABLE' to denote a letter,word or string of characters which represents another letter etc.,or a number.A variable can be just one letter or a combination of letters and numbers but must start with a letter. Letters can be upper or lower case e.g NAm1 is the same as nAM1,NAM1 or nam1.Otherwise only full stops can be used, and in certain special circumstances ,brackets. A variable may be of any length, but in practice is made as short as possible consistent with clarity. VARIABLE NAMES CANNOT BE IDENTICAL TO BASIC KEYWORDS. We have seen before that numbers and letters are sometimes treated differently and this remains the case with variables. a number can be represented by a single letter or string of characters as described above, but a letter or 'string' variable must be followed by the dollar sign $ (SHIFT + 4 key). If a number variable must always represent an integer(whole number) ,it should be followed by the % sign, although for simple programs it can usually be dispensed with. If you are a little bemused, the following listing should make all this clear. To change one set of characters for another may not seem very productive, but it is most important,as we shall see. For example we could write at the beginning of a program: pet$= "dog" .Then every time we should write "dog" we write pet$ instead. Whenever BASIC sees pet$ it will print dog in it's place. If we now change pet$="dog" to pet$="cat", the word "cat" will be substituted for the variable pet$ instead of "dog" at each occurrence. Simply by retyping one word we have changed several. Furthermore BASIC will accomplish this without error Later we shall see how to give values to variables from the keyboard [ Section e ] and how to change variable values with loops [Section d ]. Just for now let us look at the next listing,which demonstrates the points discussed above Do not be afraid to experiment with the listing as described in INTRO.D End of file PRIMER.C