loop allows you to use two or more variables to control the loop. When using
variable are separated by commas. Here is an example:
PART I
C h a p t e r 5 :
P r o g r a m C o n t r o l S t a t e m e n t s
95
PART IPART I
for(i=0, j=10; i < j; i++, j--)
Console.WriteLine("i and j: " + i + " " + j);
}
}
The output from the program is shown here:
i and j: 0 10
i and j: 1 9
i and j: 2 8
i and j: 3 7
i and j: 4 6
Here, commas separate the two initialization statements and the two iteration expressions.
When the loop begins, both
Do'stlaringiz bilan baham: