reflect.Type.typeOf
Creates a new reflect.Type
object representing a
type.
Syntax
typeOf(
val any-type )
RETURNS reflect.Type
- val is an expression. This is typically a variable, but it can be any expression supported by the language.
- any-type can be of a various kind of types.
Usage
The reflect.Type.typeOf()
class method returns a reflect.Type
object created from the expression passed a parameter.
The reflect.Type
object can then be used to call object methods to describe the
type.
The expression passed as parameter is typically a program variable. However, the typeOf() method can also directly be called with any expression.
Example
IMPORT reflect
MAIN
DEFINE arr DYNAMIC ARRAY OF RECORD
pkey INTEGER,
name VARCHAR(30)
END RECORD
DEFINE typ reflect.Type
LET typ = reflect.Type.typeOf( arr )
DISPLAY "type name 1 = ", typ.toString()
DISPLAY "type name 2 = ", reflect.Type.typeOf( 4 / 2 ).toString()
END MAIN
Shows:
type name 1 = DYNAMIC ARRAY OF RECORD
type name 2 = DECIMAL