If you mean the i++ in:
Code:for(int i=0,j=0;i<shapes; i++){
strokeCap(caps[j++]);
if(j>2) j=0;
line(x, y, x+w, y);
line(x+w,y,x+w,y+h);
line(x,y+h,x+w,y+h);
line(x, y+h, x, y);
x+=w+colSpan;
}
Then that's not too difficult to explain. That's a 'for loop'. Basically it's used to repeat the block of code contained within {braces}, which is how you manage to draw six shapes with only 4 lines: that section of code is being repeated over and over and the variable i is used to count how many times the loop repeats.
So i starts off as 0 (the 'int i=0' declares and sets the variable), then you have a condition (in this case 'i<shapes'), which determines the number of repetitions, and then you have the increment: i++. Without this i wouldn't change and you would have an infinitely repeating loop.
i++ is simply a shorthand way of saying: i = i+1;
So basically you're adding one to the value of i with each loop. So in the first loop it will be equal to 0, in the second loop it will be equal to 1, in the third loop it will be equal to 2 and so on. You might think it's weird that it starts at zero, but if you want the loop to repeat for the number of shapes then that's the best way to do it, especially when you start working with arrays (but maybe leave those till later
).
This is because of the condition 'i<shapes'. shapes=6, so you want to draw six shapes and want the loop to repeat 6 times. If i started at 1 you would find that the loop only repeats 5 times: not what you wanted. You could start with i=1, but you would then have to make your condition 'i<(shapes+1)' which makes less sense and is just plain ugly.
In your example i is just being used as a counter, but it's not unusual to use it in the code too, but I expect you'll come onto an exercise explaining that later, and also the many different ways of using for loops.