Learn Pascal
1B - Identifiers

Identifiers are names that allow you to reference stored values, such as variables and constants. Also, every program must be identified (get it?) by an identifier.

Rules for identifiers:

Several identifiers are reserved in Pascal -- you cannot use them as your own identifiers. They are:

andarray begincase constdiv dodownto
elseendfilefor forwardfunctiongotoif
inlabelmodnil notoforpacked
procedureprogramrecordrepeat setthentotype
untilvarwhilewith

Also, Pascal has several pre-defined identifiers. You can replace them with your own definitions, but then you'd be deleting part of the functionality of Pascal.

absarctan booleanchar cosdispose eofeoln
expfalseinputinteger lnmaxintnewodd
ordoutputpackpage predreadreadlnreal
resetrewriteroundsin sqrsqrtsucctext
truetruncwritewriteln

Pascal is not case sensitive! MyProgram, MYPROGRAM, and mYpRoGrAm are equivalent. But for readability purposes, it is a good idea to use meaningful capitalization!

Identifiers can be any length, but many Pascal compilers will only look at the first 32 characters or so. That is,
     ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFAlphaBeta
     ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGammaDelta

may be equivalent to some Pascal compilers because the differences begin in the 33rd character.

To make your code compilable by all compilers, use a reasonable length for identifiers -- up to 15 characters. That way, you'll also save on typing.


Previous lesson

Next lesson

Contents

Index

e-mail me


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