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. Typecase allows your code to distinguish references based on their run-time type.
VAR ref: REFANY;
TYPECASE ref OF
| NULL => (* ref is NIL *)
| REF CHAR => (* ref is a pointer to a character *)
| REF INTEGER(iref) => (* ref is a pointer to an integer, and
iref gets bound to that pointer value *)
ELSE
(* ref points to something else *)
END;