Go to the first, previous, next, last section, table of contents.

TYPECASE Statement

TYPECASE <ref expr> OF { "|" <case> ... } [ ELSE <stmts> ] END
  where
    <case> = { <type> "," ... } { "(" <id> ")" } "=>" <stmts>

<ref expr> is a pointer of some sort, and <id> is bound to the value of the reference if specified. For example:

VAR ptrVar: REFANY;

TYPECASE ptrVar OF
| NULL =>  (* <ptrVar> contains NIL *)
| REF CHAR =>  (* <ptrVar> is a pointer to a character *)
| REF INTEGER(intPtr) =>  (* <ptrVar> is a pointer to an integer, and
                             <intPtr> gets bound to that pointer value *)
ELSE
  (* <ptrVar> points to something else *)
END;


Go to the first, previous, next, last section, table of contents.