Team LiB   Previous Section   Next Section
as

Syntax

set myReal to "3.14" as real

Return value

Class identifier to the right of operator, if valid

Description

The as operator is used to coerce or cast values or variables to certain class types. The operand to the right of the as operator has to be a class identifier, such as boolean, integer, list, real, record, string, or some other object type. The expression will fail if the value in the first operand cannot be coerced to the class identified in the second operand (in fact you will find these statements raising a lot of errors as you experiment with coercing values from type to type). See Chapter 3for a discussion of which types can be coerced to different classes.

    Team LiB   Previous Section   Next Section