expression as
type
The as
operator converts the given value to the given data type. If the given value cannot be converted to the given data type, a script error is triggered.
To avoid triggering a script error, use the is a
operator before trying to convert values.