You have probably already seen set constants used in validation procedures e.g.

  write('Would you like to continue? ');
until Response in ['y', 'Y', 'n', 'N'];

A set is a collection of values of the same ordinal type. (The preceding tutorial Enumerated Types gave the definition that each value of an ordinal type except the first has a unique predecessor and each value except the last has a unique successor). The values must be ordinals so that the total number of possible values is available to the compiler. In Pascal, this number must not be greater than 256. No use is made of the order of the values in a set. Also, a set never contains duplicates of any value. An empty set (also named a null set) is possible: it is denoted by [].

Follow the links to sections showing you how to write code for sets.

Programming - a skill for life!

Pascal Programming Tutorials