<md>

# Break-n/Continue-n

Jancy features multi-level loop jumps. These are achieved with 'break-n' and 'continue-n':

<div class='new_frame snippet'>
<code name="jancy">

int a [3] [4] = 
{
	{ 1,  2,  3,  4 },
	{ 5,  6, -7,  8 },
	{ 9, 10, 11, 12 },
};

for (size_t i = 0; i < countof (a); i++)
	for (size_t j = 0; j < countof (a [0]); j++)
		if (a [i] [j] < 0)
		{
			// negative element is found, process it...

			break2; // exit 2 loops at once
		}

</code>
</div>
<br>

You can use the same for breaking out of the switch statement and then out of the outer loop:

<div class='new_frame snippet'>
<code name="jancy">

for (;;)
{
	Request request = getNextRequest ();

	switch (request)
	{
	case Request.Terminate:
		break2; // out of the loop

	case Request.Open:
		// ...
		break;

	case Request.Connect:
		// ...
		break;

	// ...
	}	
}

</code>
</div>

---
Proceed to Jancy [miscellaneous features](misc.html)
</md>
