Friday, October 5, 2007

How to work with Boolean

How to work with Boolean

To work with Boolean

Step 1

Description:

The four predefined Boolean types are Boolean, ByteBool, WordBool, and LongBool. Boolean is a preferred type.

Declaration:

Boolean ByteBool, WordBool, LongBool

False <> True

Ord(False) = 0 Ord(False) = 0

Ord(True) = 1 Ord(True) <> 0

Succ(False) = True Succ(False) = True

Pred(True) = False Pred(False) = True

Example:

if X <> 0 then ...;

var OK: Boolean

...

if X <> 0 then OK := True;

if OK then ...;

No comments: