Sign in to follow this  
Followers 0
HelloIDistance

Ending a variable

3 posts in this topic

How would I end a variable? I am trying to use this with another while command, and it seems to be stuck in the $variable loop and I can't get the other While to function properly. I have tried the $variable = $variable + 1 command to get it out of the loop, but still run properly. And it doesn't work becuase it never gets to the other while loop, any ideas?

Like if I had:

$variable = 2

While $variable > 1
;other code here

WEnd

How would I get out of that variable loop?

Thanks

Share this post


Link to post
Share on other sites



$variable = $variable - 1

Share this post


Link to post
Share on other sites

If I'm understanding you correctly, and assuming you mean $var = $var -1 instead of $var = $var + 1 (the While condition you specified becomes untrue (concludes) when $var becomes less than 2), then it sounds like what you are lacking is an ExitLoop statement to break out of your inner While loop when a condition is met, probably at the same time that you adjust the value of $var:

Dim $var = 2
While $var > 1
 ; do stuff
  While $runningSmooth = 1
   ; do stuff
    If $worldsCollide Then
      $var = $var -1
      ExitLoop
    EndIf
  Wend
  ; process jumps to here after ExitLoop
Wend

Be sure you've considered For / Next loops any time you use While looping; with the Step keyword you can count your For value up or down in fractional or whole numbers on each loop.


Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0