Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Another Difference Between Type() and VarType()
Message
From
19/01/1999 07:38:48
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00177477
Message ID:
00177518
Views:
39
>Yet this works fine...
>
>i =4.5
>y = transform(i)
>? type("y")
>? vartype(y)
>
>Output is
>C
>C
>

This is because i don't think that Albert understands how TYPE() works; TYPE() takes the character expression it is passed, evaluates it, and returns the type of the evaluated expression. I'd expect TYPE('TRANSFORM(I)') == VARTYPE(TRANSFORM(I)), since TYPE('TRANSFORM(I)') evaluates the string TO "TRANSFORM(I))", gets the result of TRANSFORM(I), "4.5", , and checks it's type, while TYPE(TRANFORM(I)) evaluates the result of the function, "4.5", gets the result of 4.5, and checks it's type.

IOW, TYPE() and VARTYPE() operate exactly as designed and expected. If you check the result of TYPE("4.5"), it returns "N", while TYPE(4.5) results in an Error "Function argument value, type, or count is invalid", since TYPE() takes a character string to evaluate, while VARTYPE() takes an actual value

>>i =4.5
>>? type(transform(i))
>>? vartype(transform(i))
>>
>>output:
>>N
>>C
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform