In C #, the question distorted me for a while, and this is what is the actual significant difference between While and For Loop. It is simply a purity of reading; everything you can do in a for loop can be done in a while loop, only in different places. So take these examples:
int num = 3;
while (num < 10)
{
Console.WriteLine(num);
num++;
}
vs
for (int x = 3; x < 10; x++)
{
Console.WriteLine(x);
}
Both code loops produce the same result and the only difference between them is that the for loop forces you to declare a new variable and also set the iteration value of each loop in the loop at the beginning? Maybe I missed something else in terms of any major differences, but it would be nice if someone could set me up right about this. Thanks.