.DT
else
$MUDNAME$ driver help
else

.SH Name
.SI 5
else - the 'false' conditional helper
.EI

.SH Synopsis
.SI 5
else
.EI

.SH Description
.SP 5 5
Else is paired with an if statement to handle false cases. If the if statement evaluates to false, the 'else' lines are executed.
.EP

.SH Example 1
.SI 5
int x;

x = 4;

if( x == 5 )
    write("How are you today?\n");
else
    write("Nice day today!\n");

The result: "Nice day today!" is printed, because the if statement, when evaluated, is false.
.EI

.SH Example 2
.SI 5
int x, y;

x = 4;
y = 7;

if( x < y )
{
    write("Hello!\n");
    x = 7;
}
else
{
    write("Goodbye!\n");
    y = 4;
}

The result: "Hello!" is printed and x is set equal to 7. The 'else' group is not executed.
.EI

.SH Example 3
.SI 5
else is also useful in multiple if statements. Be sure to look at 'help switch' as an even better way of doing this!

int x = 4;

if( x > 10 )
    write("X is greater than 10.\n");
else if( x < 0 )
    write("X is less than 0.\n");
else if( x > 5 )
    write("X is between 5 and 10.\n");
else
    write("X is between 0 and 4.\n");

The result: "X is between 0 and 4." is printed.
.EI

.SH Example 4
.SI 5
A really sneaky way to do a quick if-else combo is through the use of parenthesis.
     Take a look:
     
     string str;
     
     str = "oink";
     
     write("I really feel like a "+ ( str == "oink" ? "pig" : "cow" ) +" today!\n");
     
The result: "I really feel like a pig today!" is printed. Look at the 'thing' in parentheses. It can be broken down into three parts:
     
     ( conditional ? true : false )
     
The "conditional" part is a normal if statement. The 'true' part is what to do if the conditional is true, the 'false' part is done if the conditional is false.
     
Note - This is the better way to do conditional statements. It's much easier on the CPU, and saves time and memory.
.EI


.SH See also
.SI 5
if, switch
.EI
