Wednesday, April 2, 2014

Loop Functionality

1) while (x > 5)
{
x = x - 3;
}
In a while loop, all of the statements inside the curly brackets get executed as long as the condition in the
parentheses is true.

2) for (int i = 0; i < 8; i = i + 2)
{
MessageBox.Show(“I’ll pop up 4 times”);
}

Every for loop has three statements. The first sets up the loop. The statement will keep looping as long as
the second one is true. And the third statement gets executed after each time through the loop.

No comments:

Post a Comment