Creating a for loop
Now let's begin creating our for loop. Our for loop is going to run 26 times; each time it runs, it will take the next character in the English alphabet and place it in our character array: alpha.
To make sure our for loop runs exactly 26 times, we should declare a counting variable, say i, and set it to 0, that is, (i=0). Next, let's say that our for loop should continue to run as long as the value of our counting variable is less than 26, that is, it should take values between 0 and 25 (i<26). Lastly, every time our for loop runs, we need to increase the value of our counting variable by one so that it goes up each time, and after 26 iterations, the i<26 statement will no longer be true and our loop will stop at (i++ ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access