Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Argument starter - The roots of all evil
Message
From
07/09/2004 10:45:20
 
 
To
07/09/2004 10:07:59
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00938079
Message ID:
00939957
Views:
38
>>Surely you'd use a CASE statement though?
>
>Of course, but I've had cases where it wasn't enough. There may be a number of objects to be created, properties checked, and not all of them are having eliminating conditions, so there's the "heavy checking" phase at the top of the loop, then decision on whether to continue, then the beef.

Then the "heavy" checking is decoupled to a proc/func.
>>>
>>lnLen = ALEN( this.aList, 1)
>>I = 1
>>Do while I <= lnLen ;
>>   and not EMPTY( lcValue)
>>	lcValue = prof_r( This.cSection, "row"+Transform( I), "", "C")
>>	If not Empty( lcValue)
>>		this.alist( I) = lcValue
>>         Else
>>                   I = I + 1
>>	EndIf
>>EndDo
>>
>
>Nice and not too much longer. You forgot one extra line, to initialize the lcValue to something not empty. Still, I'm not convinced that simulated for-endfor loops are better than real ones, just because you don't want to use Exit. If speed was an issue, I'd think twice before doing the test (as simple as empty() function) twice each run of the loop.
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform