Next Previous Contents

83. typecast


Convert an object from one data type to another.


typecast (x, new_type)


The typecast function performs a generic typecast operation on x to convert it to new_type. If x represents an array, the function will attempt to convert all elements of x to new_type. Not all objects can be converted and a type-mismatch error will result upon failure.


    define to_complex (x)
       return typecast (x, Complex_Type);
defines a function that converts its argument, x to a complex number.
See Also

int, double, typeof

Next Previous Contents