October 2017
Beginner
318 pages
7h 26m
English
Loops and arrays get along great because arrays always know how long they are, but a single for loop doesn't allow us to meaningfully loop through a two-dimensional array. A for loop really just goes in one direction, and our two-dimensional arrays have two directions.
To solve this, we're going to make use of nested for loops, or a for loop within a for loop. Our outer for loop will loop through each array in turn, while the job of our inner for loop will be to loop through the nodes that those arrays contain.
A common practice when creating for loops is to use the integer variable i for your initial for loop, and then j, k, and so on for subsequent for loops. However, because we're creating ...
Read now
Unlock full access