[Solved] Can’t create two int in for statement [closed]


You got the initialization (first) part of the loop right.

The termination or condition (second) part of the loop should be evaluated to a boolean, so assuming you require an AND relation between the conditions on a and b, it becomes a<101 && b<102. You might want || (OR) instead, depending on your logic.

The increment (third) part of the loop should contain comma separated expressions (same as the initialization part which you already got right).

I also removed an extra ‘;’ from the end.

for(int a=0, b=0; a<101 && b<102; a++, b++) { stuff }

0

solved Can’t create two int in for statement [closed]