0
For loops got me stuck with no points to help
3 Respostas
+ 7
for (initialization; condition; increment)
{
//do something
}
E.g.
for (int i = 0; i < 10; i++)
{
}
is similar to
int i = 0;
while (i < 10)
{
i++;
}
0
For loops are wonderful! If you know how many times you want to iterate (doing the thing you wanna do many times over) they help get you there.
Let's say you wanna do something 100 times.
in pseudocode
for x=0 (provide initial value) x<100 (set your boundary) x++ (x is increasing by 1 for every iteration)
{
//do a thing
}
for x=0; x<100; x++;
{
//do a thing
}
0
thank you