Thus far we've used an if/print structure inside a loop to select certain rows to print or not. In this short section, we'll use a variable with a little code to count how many times an if-test is true. Below is a loop as we have seen before that detects all the names that start with "A". After printing the rows, the code prints a summary of how many names started with "A".
Three additions to the standard loop/if/print structure we've used up to now:
count = 0;
count = count + 1;
x = x + 1;increments the value stored in a variable
Inside the if-statement,
count++; to mean increase by 1.