Saturday, August 3, 2013

Nested

bool tralse false;
bool fruetrue;


if (tralse) {
    I would like this statement to run;
    // Too bad: the condition is false and so this statement wiln't run. 
    if (frue) {
        I would like this statement to run as well;
    // Too bad: the initial condition is false and so compiler immediately turns it's snout up at this nested if statement
}
}

When nesting for loops you have to use different names for the incrementer


for(int x = 1; x < 1000: x *= 2)
   {
   for(int y = 1; y < 1000: y *= 2)//Not the best example
      {
         if (y == 8 || y == 32)
         {
            continue;
         }  
       Console.WriteLine("etcétera bla bla bla"); 
      }
    if (y == 8 || y == 32)
    {
       continue;
    }  
    Console.WriteLine("etcétera bla bla bla"); 
   }  

No comments:

Post a Comment