09.10.2014 Views

download pascal tutorial (pdf - Tutorials Point

download pascal tutorial (pdf - Tutorials Point

download pascal tutorial (pdf - Tutorials Point

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER<br />

7<br />

Constants<br />

This section shows the constants used in a Pascal program.<br />

A<br />

constant is an entity that remains unchanged during program execution. Pascal<br />

allows only constants of the following types to be declared:<br />

<br />

<br />

<br />

<br />

<br />

<br />

Ordinal types<br />

Set types<br />

<strong>Point</strong>er types (but the only allowed value is Nil).<br />

Real types<br />

Char<br />

String<br />

Declaring Constants<br />

Syntax for declaring constants is as follows:<br />

const<br />

identifier = constant_value;<br />

The following table provides examples of some valid constant declarations:<br />

Constant Type<br />

Examples<br />

Ordinal(Integer)type constant valid_age = 21;<br />

Set type constant<br />

<strong>Point</strong>er type constant<br />

Real type constant<br />

Character type constant<br />

Vowels = set of (A,E,I,O,U);<br />

P = NIL;<br />

e=2.7182818;<br />

velocity_light = 3.0E+10;<br />

Operator = '+';<br />

TUTORIALS POINT<br />

Simply Easy Learning Page 21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!