Incrementing/Decrementing not by 1
-
What is the proper syntax for incrementing or decrementing NOT by 1, but rather with another number in a For Loop? I am trying to count by threes and "for(i=0;i<=30;i+3;) doesn't work. Why? The books and tutorials are great at telling you how to increment by 1 but rarely cover anything else.
-
What is the proper syntax for incrementing or decrementing NOT by 1, but rather with another number in a For Loop? I am trying to count by threes and "for(i=0;i<=30;i+3;) doesn't work. Why? The books and tutorials are great at telling you how to increment by 1 but rarely cover anything else.
The operator you are looking for is
+=
like so:for(i = 0; i <= 30; i **+=** 3)
Also you have a spurious semicolon before the close bracket. Cheers, PeterSoftware rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012