<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://coderwiki.org/index.php?action=history&amp;feed=atom&amp;title=Foreach_loop</id>
	<title>Foreach loop - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://coderwiki.org/index.php?action=history&amp;feed=atom&amp;title=Foreach_loop"/>
	<link rel="alternate" type="text/html" href="http://coderwiki.org/index.php?title=Foreach_loop&amp;action=history"/>
	<updated>2026-05-19T01:40:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://coderwiki.org/index.php?title=Foreach_loop&amp;diff=120&amp;oldid=prev</id>
		<title>Dylan: Dylan moved page For each loop to Foreach loop: Misspelled title</title>
		<link rel="alternate" type="text/html" href="http://coderwiki.org/index.php?title=Foreach_loop&amp;diff=120&amp;oldid=prev"/>
		<updated>2025-08-15T10:22:31Z</updated>

		<summary type="html">&lt;p&gt;Dylan moved page &lt;a href=&quot;/For_each_loop&quot; class=&quot;mw-redirect&quot; title=&quot;For each loop&quot;&gt;For each loop&lt;/a&gt; to &lt;a href=&quot;/Foreach_loop&quot; title=&quot;Foreach loop&quot;&gt;Foreach loop&lt;/a&gt;: Misspelled title&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:22, 15 August 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Dylan</name></author>
	</entry>
	<entry>
		<id>http://coderwiki.org/index.php?title=Foreach_loop&amp;diff=119&amp;oldid=prev</id>
		<title>Dylan: new: info, example, iterating a range</title>
		<link rel="alternate" type="text/html" href="http://coderwiki.org/index.php?title=Foreach_loop&amp;diff=119&amp;oldid=prev"/>
		<updated>2025-08-15T10:13:54Z</updated>

		<summary type="html">&lt;p&gt;new: info, example, iterating a range&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;A &amp;#039;&amp;#039;&amp;#039;foreach loop&amp;#039;&amp;#039;&amp;#039; is an [[iteration]] structure in code which allows us to loop through a [[code block]] for each [[Collection element|element]] in a [[collection]].&lt;br /&gt;
&lt;br /&gt;
It is a form of [[definite iteration]], or &amp;#039;&amp;#039;&amp;#039;count-controlled&amp;#039;&amp;#039;&amp;#039; [[iteration]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
In the below [[C Sharp]] code, we loop through the [[Value|values]] of the &amp;lt;code&amp;gt;fruits&amp;lt;/code&amp;gt; array and print out each [[Collection element|element]]:&amp;lt;syntaxhighlight lang=&amp;quot;cs&amp;quot; line=&amp;quot;1&amp;quot;&amp;gt;string[] fruits = {&amp;quot;Banana&amp;quot;, &amp;quot;Apple&amp;quot;, &amp;quot;Peach&amp;quot;, &amp;quot;Strawberry&amp;quot;, &amp;quot;Raspberry&amp;quot;};&lt;br /&gt;
foreach (string fruit in fruits)&lt;br /&gt;
{&lt;br /&gt;
    Console.WriteLine(fruit);&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;The code above will give the following output:&lt;br /&gt;
 Banana&lt;br /&gt;
 Apple&lt;br /&gt;
 Peach&lt;br /&gt;
 Strawberry&lt;br /&gt;
 Raspberry&lt;br /&gt;
&lt;br /&gt;
== Iterating a range of values ==&lt;br /&gt;
If you instead want to loop over a range of [[Integer|integers]] or another type of [[range]], you should instead use a regular [[for loop]].&lt;br /&gt;
&lt;br /&gt;
See: [[For loop]]&lt;/div&gt;</summary>
		<author><name>Dylan</name></author>
	</entry>
</feed>