Skip to content

For Loops

CodingUnit edited this page Nov 30, 2011 · 2 revisions

For Loops

  • Category: For and While Loops

  • Description: Some simple nested ’for’ loops

  • Code:

 using System; 
 using System.Console; 
 using Nemerle;

def SampleForLoop3() 
{

    foreach (i in [0 .. 9])
    {
        foreach (j in [0 .. i - 1])
            Write(" ");
        foreach (j in [i .. 9])
            Write(j);
        WriteLine(" ")
    }    

}

SampleForLoop3() 
  • Execution Result:
0123456789 
 123456789 
  23456789 
   3456789 
    456789 
     56789 
      6789 
       789 
        89 
         9 

[Copyright ©](Terms of use, legal notice)

Clone this wiki locally
You can’t perform that action at this time.