13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

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.

The Pascal types discussed in the previous chapter are simple linear waysof representing data. Now we shall consider the more complex data types­STRING, SET, ARRAY, and RECORD, plus two special types,BYTESTREAM and WORDSTREAM.The STRING TypePascal strings are sequences of up to 255 alphanumeric characters. Stringvariables are used to hold all kinds of written text: names, words,sentences, sequences of keyboard symbols, and numbers when they are notbeing treated arithmetically. Each character element of a string variablemay correspond to any of the 256 ASCII codes, including 0.String constants may be introduced anywhere in your Pascal program, byenclosing a sequence of 2 to 255 characters inside single quotation marks.The Compiler will reject any string constants that contain CONTROL-C orRETURN (ASCII codes 3 and 13), although it will accept the "high ASCII"equivalents (codes 131 and 141). Other control characters may causeediting problems when you are writing program text.String variables have no such restrictions. To add CONTROL-C, RETURN,or other control characters to a string variable, you can follow the specialprocedures described under the CHR function in Chapter 6.Pascal strings may be used with the following operations::= < > = = LENGTH POS CONCAT COPY DELETE INSERT STRFor a description of the results of using relational operations to comparestrings, see "Relational Operators" in Chapter 6.String SizeWhen a variable is declared as type STRING without further specification,Pascal sets aside enough memory to contain 80 characters. If your programwill never try to place that many characters in the variable, you canconserve memory by declaring a shorter maximum length. If your programmight try to place more than 80 characters in the variable, you mustIII-38Chapter 4: Structured Data Types

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

Saved successfully!

Ooh no, something went wrong!