Continue a loop from Function

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Nickyeo
Posts: 18
Joined: 12 Feb 2019, 04:22

Continue a loop from Function

07 May 2019, 20:29

Code: Select all

Loop, 5
{
Function1()
Function2()
Function3()
}

Function1()
{
Msgbox, This is a good day.
}

Function2()
{
msgbox,, 4100, Are you sure this is a good day?
Ifmsgbox, No
;This is the part where I want to break off and continue to loop
 :?: ???????

}

Function3()
{
msgbox, Thank you
}
This is just a simpler version of what I am working on. Thanks in advance for helping me out. =)
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Continue a loop from Function

07 May 2019, 20:58

Do you mean that, if the user chooses No, the call to Function3 should be skipped and the loop started from the top? If so, you can accomplish it like this:

Code: Select all

Loop, 5
{
Function1()
If Function2()
    Continue
Function3()
}

Function1()
{
Msgbox, This is a good day.
}

Function2()
{
msgbox, 4,, Are you sure this is a good day?
Ifmsgbox, No
    Return true
}

Function3()
{
msgbox, Thank you
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: busymind, FortniteSpanishGuy, Google [Bot], peter_ahk, Spawnova and 100 guests