>>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.