VARIABLE NAMES
Variable names are a maximum of 32 alphanumeric characters. Some Pascal versions only recognise the first eight characters. The first letter of the data name must be ALPHABETIC (ie A to Z ). Lowercase characters ( a to z ) are treated as uppercase. Examples of variable names are,


	RATE_OF_PAY      HOURS_WORKED   B41   X   y   Home_score

                       

Give variables meaningful names, which will help to make the program easier to read and follow. This simplifies the task of error correction.


ASSIGNING VALUES TO VARIABLES
Having declared a variable, you often want to make it equal to some value. In pascal, the special operator

	:=



provides a means of assigning a value to a variable. The following portion of code, which appeared earlier, illustrates this.


	var number1, number2, number3 : integer;

	begin

		number1 := 43;   { make number1 equal to 43 decimal }

		number2 := 34;   { make number2 equal to 34 decimal }

		number3 := number1 + number2;  { number3 equals 77  }



When assigning values to char variables, only one character is assignable, and it is enclosed inside single quotes, eg,


	var  letter : char;

	begin

		letter := 'W';   { this is correct }

		letter := 'WXY'; { this is wrong, only one character allowed }



When assigning values to real variables, if the value is less than zero, use a leading zero, eg,


	var  money : real;

	begin

		money := 0.34;   { this is correct }

		money := .34;    { this is wrong, must use leading zero }

		money := 34.5;   { this is correct }




Copyright B Brown/P Henry/CIT, 1988-1997. All rights reserved.