Mehrere Schleifen ineinander schnell verlassen?

  • Hallo,

    wie verlasse ich am besten/schnellsten eine oder mehrere Schleifen?

    HotKeySet("{F10}", "stop")$loop = true

    While 1
    While 1
    While 1
    If $loop = false then
    WEnd
    WEnd
    WEnd

    Func stop()
    $loop = false
    EndFunc

  • Exitloop verlässt dann alle Schleifen?


    Du kannst die Ebene angeben, die verlassen werden soll.
    Siehe

    [autoit]

    ExitLoop

    [/autoit]

    einfach draufklicken.

    There's a joke that C has the speed and efficieny of assembly language combined with readability of....assembly language. In other words, it's just a glorified assembly language. - Teh Interwebz

    C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, you blow off your whole leg. - Bjarne Stroustrup
    Genie zu sein, bedeutet für mich, alles zu tun, was ich will. - Klaus Kinski

  • Also bei mir bleibts auch nach 5x drücken in der letzten Schleife

    edit: kA warum der code hier so zusammengepresst wird..

    [autoit]

    HotKeySet("{END}", "stop")Global $loop = True
    While 1 Sleep(2000) MsgBox(0,"","While 1") While 1 Sleep(2000) MsgBox(0,"","While 2") While 1 Sleep(2000) MsgBox(0,"","While 3") If $loop = false Then ExitLoop WEnd WEndWEnd
    Func stop() $loop = FalseEndFunc ;==>stop

    [/autoit]
  • Hallo attaxx,

    du kannst hinter ExitLoop angeben, die wievielte Schleife verlassen werden soll. (1 = innerste Schleife). Also in etwa so:

    [autoit]

    HotKeySet("{F10}", "stop")
    $loop = true

    [/autoit][autoit][/autoit][autoit]

    While 1 ; ExitLoop 3
    While 1 ; ExitLoop 2
    While 1 ;ExitLoop 1
    If $loop = false Then
    ExitLoop 3
    EndIf
    WEnd
    WEnd
    WEnd

    [/autoit][autoit][/autoit][autoit]

    Func stop()
    $loop = false
    EndFunc

    [/autoit]

    MfG Xenon :)