Jump to content
Sign in to follow this  
Dieuz

Stop While Loop

Recommended Posts

Dieuz

How can I terminate a while loop using a different button?

$Stop = False

;Gui Here

While 1

    $msg = GUIGetMsg()

    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button1
            Start()
        Case $msg = $Button2
            Stop()

    EndSelect


WEnd

Func Start()

  While $Stop = false
  ; Do stuff
  Wend

EndFunc

Func Stop()

       $Stop = true

EndFunc

Thanks,

Dieuz

Edited by Dieuz

Share this post


Link to post
Share on other sites
kaotkbliss

try

ExitLoop [level]

Parameters

level [optional] The number of loop levels to exit from. The default is 1 (meaning the current loop).

Remarks

A negative level or zero value has no effect.

ExitLoop will break out of a While, Do or For loop.

ExitLoop is useful when you would otherwise need to perform error checking in both the loop-test and the loop-body.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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  

×