contents   index   previous   next



else

 

The else statement is an extension of the if statement. It allows you to tell your program to do something else if the condition in the if statement was found to be false. In ScriptEase code, it looks like the following.

 

if ( goo < 10 ) 

{

   Screen.write("goo is smaller than 10\n");

else

{

   Screen.write("goo is not smaller than 10\n");

}

 

To make more complex decisions, else can be combined with if to match one out of a number of possible conditions. The following fragment illustrates using else with if.

 

if ( goo < 10 ) 

{

   Screen.write("goo is less than 10\n");

   if ( goo < 0 ) 

   {

      Screen.write("goo is negative; so it's less than 10\n");

   }

else if ( goo > 10 ) 

{

   Screen.write("goo is greater than 10\n");

}

else 

{

   Screen.write("goo is 10\n");

}

 


while