Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ISSUE or BUG: FOR TO STEP not support nulls
Message
From
13/08/2004 12:08:07
 
 
To
13/08/2004 11:23:20
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Miscellaneous
Thread ID:
00933070
Message ID:
00933171
Views:
18

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:
* Now
LOCAL oneVariable  && oneVariable is a Logical set to empty

* Definitive Best for me
SET NEWVARASNULL TO ON
LOCAL oneVariable  && oneVariable is a NULL value with data type X ( unknown )
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) && this null is a numeric
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
* NEXT IS SKIPPED
FOR I=1 TO -1 STEP -0
NEXT
? 'END'

* NEXT IS SKIPPED
FOR I=1 TO -1 STEP -0
NEXT
? 'END'

? 'PRESS ESC TO STOP'
* NEXT GO INTO A INFINITE LOOP
FOR I=-1 TO 1 STEP 0
NEXT
? 'END'
Then, it check NULL, but not check 0.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform