Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Syntax
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Re: Syntax
Miscellaneous
Thread ID:
00364024
Message ID:
00364036
Views:
34
Cavin,

If something changes and you want to end the loop before it otherwise would, use the EXIT command.
for m.lnCounter = 1 to 20
  * do the processing here - e.g.
  ? m.lnCounter

  * check for the exit condition - e.g.
  if rand() < 0.05
    EXIT
  endif
endfor
In this example, the loop has a 5% chance of exiting prematurely for each of the 20 passes through the loop. (A 62% chance of exiting before processing 20 times)

Cheers,

Andrew

>Dear all:
> In "For loop" how can control when the var change is stop the looping ??
> Thx !!


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform