I would expect it to not support nulls. A null is no data type and contains no value.
This is incorrect.
A NULL is a unknown value with:
1) a data type unknown (this not exists on VFP)
I would be much happy one if VFP support this
( with a command as this
SET NEWVARASNULL TO ON|OFF)
Example:
LOCAL oneVariable
SET NEWVARASNULL TO ON
LOCAL oneVariable
2) the data type known,
on VFP all the NULL have data type known
Why would you expect Visual FoxPro to treat the null as a numeric?
Because, i can do this :
? STR(NULL)
But, to prescind from the fact that VFP is one language correctly planned,
if FOR support NULL, it is usefull.
Example :
I can implement STEP NULL ( like unknown ) for skip the FOR loop,
regardless the initValue and endValue.
This have sense because if anyone of the 3 parameters is unknown, then the FOR cycle is not computable, then two choices are possible
- fire a error
- skip the FOR cycle.
Then: because VFP is not a strong typed language, the error is not usefull.
In-fact i found this issue into a procedure where the endValue go to NULL,
and with NULL i want that the FOR cycle are skipped.
*****
Another thing:
Expect you that FOR support STEP 0 ?
Run this:
SET ESCAPE ON
CLEAR
FOR I=1 TO -1 STEP -0
NEXT
? 'END'
FOR I=1 TO -1 STEP -0
NEXT
? 'END'
? 'PRESS ESC TO STOP'
FOR I=-1 TO 1 STEP 0
NEXT
? 'END'
Then, it check NULL, but not check 0.