Hi,
Two days back, while discussing with a friend came a small interesting (programming) situation where he wanted to stop (break) a loop which was inside another loop.
You can think of the situation as he was first looping through all the rows in a grid view and then in the entire column in the grid view. Now he was trying to look into the text of each cell, and if the text matched a given value, he needed to break from both the loop and execute the statement after the loop.
His first idea was to use a flag which will be checked in the outer loop every time to see if the value has been found in the inner loop. The code would be something like below.