What's the difference between Vartype and Type

Happy New Year… I took some time off to spend with my family.

To get the type of variable “MyVar”, you can use TYPE(“MyVar”) or VARTYPE(MyVar). Notice no quotes are used for VARTYPE.

TYPE(cExp) scans and compiles the expression in the string parameter. For example, for TYPE(“3+4”), VFP will compile the expression in the string parameter, evaluate it, then return the type of the result. Putting it in a loop causes the string to be compiled each time. It has been in the language since foxbase days

VARTYPE(eExp) will just return the type of the value at the top of the Fox expression stack. There is no extra compilation step and the expression is evaluated just as any VFP expression before the VARTYPE routine gets called to return the type of the value at the top of the stack. VARTYPE was added around VFP6.

Which do you think is faster?

ns=SECONDS()

zz="a"

FOR i = 1 TO 1000000

* cc=TYPE("zz")

      cc=VARTYPE(zz)

ENDFOR

?SECONDS()-ns