Page 1 of 1

Break an inner loop and continue an outer loop

Posted: 22 Apr 2015, 12:47
by toralf
How could I break an inner loop and continue an outer loop (thus skipping the rest of the outer loop) in the same line/block as the break command for the inner loop?

The only way I can currently think of is using a var that I have to check after the inner loop and if true sets continue for the outer loop

Any other suggestions?

Re: Break an inner loop and continue an outer loop

Posted: 22 Apr 2015, 12:55
by RHCP
Like this?

Code: Select all

loop 
{
	msgbox % A_Index
	loop
	{
		continue, 2
		msgbox never going to be shown
	}
	msgbox never going to be shown
}

Re: Break an inner loop and continue an outer loop

Posted: 22 Apr 2015, 13:01
by toralf
Thanks a lot. I thought I had to send first a break. I was mistaken.

Re: Break an inner loop and continue an outer loop

Posted: 15 Oct 2018, 14:21
by SL5
__ __https://autohotkey.com/docs/commands/Break.htm