<?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=For_loop</id>
	<title>For loop - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://coderwiki.org/index.php?action=history&amp;feed=atom&amp;title=For_loop"/>
	<link rel="alternate" type="text/html" href="http://coderwiki.org/index.php?title=For_loop&amp;action=history"/>
	<updated>2026-05-19T04:37:19Z</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=For_loop&amp;diff=118&amp;oldid=prev</id>
		<title>Dylan: new: info, example, iterating a collection</title>
		<link rel="alternate" type="text/html" href="http://coderwiki.org/index.php?title=For_loop&amp;diff=118&amp;oldid=prev"/>
		<updated>2025-08-15T10:07:05Z</updated>

		<summary type="html">&lt;p&gt;new: info, example, iterating a collection&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;for loop&amp;#039;&amp;#039;&amp;#039; is an [[iteration]] structure in code which allows us to loop through a [[code block]] and easily [[Incrementation|increment]] a variable each time.&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 numbers 1-5 and print each number to the console:&amp;lt;syntaxhighlight lang=&amp;quot;cs&amp;quot; line=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
for (int i = 1; i &amp;lt;= 5; i++)&lt;br /&gt;
{&lt;br /&gt;
    Console.WriteLine(i);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Iterating a collection ==&lt;br /&gt;
If you instead want to loop over a [[collection]], you can either use a regular &amp;#039;&amp;#039;&amp;#039;for loop&amp;#039;&amp;#039;&amp;#039; and [[Iteration|iterate]] over each [[Collection index|index]] of the [[collection]], or you can use a [[for each loop]] to iterate over the [[Collection element|elements]] themselves.&lt;br /&gt;
&lt;br /&gt;
See: [[For each loop]]&lt;/div&gt;</summary>
		<author><name>Dylan</name></author>
	</entry>
</feed>