<<< Enhanced for loop | Index | Computing the average in enhanced loop >>> |
Enhanced for loop is also known as foreach loop.
The syntax to use "foreach" loop to process the elements of an array is:
for (dataType identifier : arrayName) { statements }
Here, the identifier is a variable, and the data type of identifier is the same as the data type of the array elements
<<< Enhanced for loop | Index | Computing the average in enhanced loop >>> |