Home Tags foreach
foreach

foreach is a looping construct that executes a given piece of code for each element in a list/collection/array. In contrast to a for loop, the foreach loop doesn't require the coder to maintain a counter variable to avoid off-by-one (fencepost) bugs. It is recommended to use when simple iteration over whole array/list/collection is needed.

0 questions