Monday, April 21, 2014

Breaking out of a nested loop c# aspnet

for (int i = 0; i < 100; i++)
{
    for (int j = 0; j < 100; j++)
    {
        if (exit_condition)
        {
            // cause the outer loop to break:
            i = INT_MAX;
            // break the inner loop
            break;
        }
    }
}

No comments:

Post a Comment