Type Function (String, Long) |
Namespace: XSharp.RT
[NeedsAccessToLocalsAttribute(FALSE)] FUNCTION Type( cString AS STRING, nArray AS LONG ) AS STRING
Tip |
---|
Array references: References to private and public arrays return "A." References to array elements return the type of the element.
If(): To return the appropriate data type for an If() expression, Type() evaluates the condition then returns the type of the evaluated path. If either the If() condition or the evaluated path are invalid, Type() returns "UE." Testing parameters: Type() can only test the validity of parameters received using the PARAMETERS statement. Testing a parameter declared as part of a FUNCTION or PROCEDURE declaration always returns "U." because local parameters do not have a symbol in the symbol table. To determine whether an argument was skipped or left off the end of the argument list, compare it to NIL or use IsNil(). |
1? Type('Substr("Hi There", 4, 5)') // C 2? Type("UdF()") // UI 3? Type('If(TRUE, "true", 12)') // C 4PROCEDURE NilParameters() 5 PARAMETERS cParam1, nParam2, uParam3 6 IF cParam1 = NIL 7 ? "First parameter was not passed" 8 cParam1 := "Default value" 9 ENDIF 10 IF Type("nParam2") = "U" 11 ? "Second parameter was not passed" 12 ENDIF 13 IF IsNil(uParam3) 14 ? "Third parameter was not passed" 15 ENDIF 16. 17. <paramref name="Statements" /> 18.
1num := 10 // Undeclared variable 2? Type("num + num") // N 3? ValType(num + num) // N 4? UsualType("num + num") // 7 (stands for STRING) 5? UsualVal(num + num) // 20