forms of if-else

There are many way to write if-else statement in program,it can be single if statement,both if-else statement,if-else if statement and etc. There are no limit on how deeply the if's and the else's can be nested. Now let's start to form of if-else  :

1. if(condition)
     do this;
2. if(condition)
   {
     do this;
     and this;
   }
3. if(condition)
     do this;
   else
     do this;
4. if(condition)
   {
     do this;
     and this;
   }
   else
     do this;
5. if(condition)
   {
     do this;
     and this;
   }
   else
   {
     do this;
     and this;
   }
6. if(condition)
     do this;
   else
   {
     if(condition)
       do this;
     else
     {
       do this;
       and this;
     }
   }
7.  if(condition)
    {
      if(condition)
       do this;
     else
     {
       do this;
       and this;
     }
   }
   else
     do this;
8.  if(condition)
      do this;
    else if(condition)
      do this;
    else if(condition)
      do this;
    else
      do this;


And now you thinking, what the hell condition? Don't worry, its quite simple and easy to use in programming. In condition part we put data,numeric values with with appropriate operator like as Logical operator, Arithmetic operator etc.

Comments