Two For Loops Holding Values

I want the second for loop to hold its value and not reset every time I break out. Is there a way to do this using static variables? Just curious, thanks.

1
2
3
4
5
6
7
8
for (int x = xx; x > xx - 4; x--)
{
	for (static int y = yy; y > yy - 4; y--)
	{
		//do something
		break;
	}
}
just a suggestion, u declare y outside the 2 loop, but remember to give it a starting value before the 2nd loop take place. Or u use a global variable to hold the value of "y" if some condition meet like :

if (..condition..){GlobalVariable = y;}
Topic archived. No new replies allowed.