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 expression formed by writing NOT in front of a boolean expressionsimply changes its value from TRUE to FALSE or from FALSE to TRUE.When two boolean expressions are connected by AND, the result is TRUEonly if both expressions are TRUE; otherwise it is FALSE.When two boolean expressions are connected by OR, the result is TRUE ifeither or both expressions are TRUE. It is FALSE only if both are FALSE.To create an exclusive-or expression with logical operators you can writeccx AND NOT Y> OR mar x AND vn.Asimplerexclusive-orexpression is given in the previous section, "Logic Using RelationalOperators."IOther Uses of Logical Operators: The logical operators NOT, AND,and OR are also used for operations on the individual bits in Pascal datawords. See "Bit Operations" later in this chapter.Scalar OperationsApple Pascal provides five useful functions for manipulating scalar datatypes:ODD(X) CHR(X) ORD(X) SUCC(X) PRED(X)The first three-ODD, CHR, and ORD-allow you to change data from onetype to another. The other two, SUCC and PRED, help you increment anddecrement scalar data values.The ODD function accepts an integer expression and returns a booleanvalue. If the integer value is odd, the boolean value is TRUE; if the integervalue is even, the boolean value is FALSE.The CHR function accepts an integer expression in the range 0 .. 255, andreturns a value of type CHAR. The CHAR value is the character whoseASCII code is the same as the integer value. The CHR function is handy forexpressing character constants that are not easy to enter directly in yoursource text-for example, control characters and characters with ASCIIcodes above 127.III-90Chapter 6: Operations on Data

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

Saved successfully!

Ooh no, something went wrong!