[banner image]
taoyue.com : Learn Pascal tutorial : 1D - Variables and Data Types

Variables are similar to constants, but their values can be changed as the program runs. Variables must first be declared in Pascal before they can be used:

     var
        IdentifierList1 : DataType1;
        IdentifierList2 : DataType2;
        IdentifierList3 : DataType3;
        ...

IdentifierList is a series of identifiers, separated by commas (,). All identifiers in the list are declared as being of the same data type.

The basic data types in Pascal include:

Standard Pascal does not make provision for the string data type, but most modern compilers do. Experienced Pascal programmers also use pointers for dynamic memory allocation, objects for object-oriented programming, and many others, but this gets you started.

More information on Pascal data types:

An example of declaring several variables is:

     var
        age, year, grade : integer;
        circumference : real;
        LetterGrade : char;
        DidYouFail : Boolean;

<<< Previous Table of Contents Next >>>

taoyue@mit.edu
Copyright © 1997-2004 Tao Yue. All rights reserved.