Please enable JavaScript to use CodeHS

AP CSA: VAR-2.G.3

CodeHS Lessons

The outer loop of a nested enhanced for loop used to traverse a 2D array traverses the rows. Therefore, the enhanced for loop variable must be the type of each row, which is a 1D array. The inner loop traverses a single row. Therefore, the inner enhanced for loop variable must be the same type as the elements stored in the 1D array.

Standard
8.2 Traversing 2D Arrays
Standard
5.10 Traversing 2D Arrays
Standard
9.10 Traversing 2D Arrays
Standard
7.10 Traversing 2D Arrays
Standard
15.2 Traversing 2D Arrays
Standard
14.2 Traversing 2D Arrays
Standard
7.10 Traversing 2D Arrays