Hot Student Stories

The ____ loop is particularly useful when processing arrays.

1 answer

1 answer

Kathy Robinson on December 21, 2018

The FOR each loop is particularly useful when processing arrays. The most recent statement is called the enhanced for or for each one because it is called this in other programming languages. It is used in preference to the standard for loop if applicable because it is much readable. The range of value of the for each loop is used to access each successive value in a collection of values. It is commonly used to iterate through an array or a collection class, for example, is the array of the list. You can also iterate over anything that implements the interface iterable, which is to define iterator method. Many of the collections classes implement iterable, which causes the for each loop very useful.

Add you answer