Using return to exit a loop?
<p>If I write a for, do, or while loop, is it possible to come out of this with the return keyword?</p>

<p>Eg:</p>

<pre><code>class BreakTest 
{
public static void Main() 
{
  for (int i = 1; i &lt;= 100; i++) 
  {
     if (i == 5) 
        **return;**
     Console.WriteLine(i);
    }
   }
}
</code></pre>

<p>I know return can be used to exit if statements so I am curious about this as I have never tried it (and can't access my software to write the code to test this).</p>
