Abstract
The foreach loop is primarily designed to make working with arrays and collection values easier, allowing you to refer to each element of an array without knowing the number of elements in it. The foreach statement: enumerates the elements of a collection and executes its body for each element of the collection. This article discusses the foreach operator and how to write programs using this operator, test and execute different parts of the code based on test results.
References
"D Programming Language foreach Statement Documentation". Digital Mars. Retrieved 2008-08-04.
"SWI-Prolog -- foreach/2". www.swi-prolog.org. Retrieved 2020-02-10.
http://www.rebol.com. {{cite web}}: Missing or empty |title= (help)
http://www.red-lang.org. {{cite web}}: Missing or empty |title= (help)
"Proposed ECMAScript 4th Edition – Language Overview" (PDF). Retrieved 2020-02-21.
"Enhanced for Loop - This new language construct[...]" "Java Programming Language, Section: Enhancements in JDK 5". Sun Microsystems, Inc. 2004. Retrieved 2009-05-26.
This work is licensed under a Creative Commons Attribution 4.0 International License.