| NWN2 Scripting. |
Simulation Training. Introduction Home First Program Seeing Results Variables and Data Types Comments Functions Data Conversion Random Numbers Concatenation Arithmetic Operators Compound Assignments One More or Less Precedence Relational Operators The Open Branch The Closed Branch Logical AND Logical OR Compound Statements ELSE If Switch Case The ? Operator The for Loop The while Loop The do while Loop Introduction to Functions Passing Values Passing Multiple Values Multiple Functions Simplifying Functions TRUE/fALSE Conditions Return Values Setting Global Variables Getting Global Variables Setting Local Variables Getting Local Variables WayPoints Introduction Static Waypoint Sets Dynamic Waypoint Sets Dynamic WP Cycles Input Output |
Else IfYou can compound else if statments. Doing this can offer you a range of selections that goes beyond the simple two selectiosn if the if else.
The Else If The else if statment can be viewed as if (expression1) statment1 else if (expression2) statment2 else statment3 What this mean is that if expression1 is TRUE then statment1 will be executed and none of the other statments. If expression2 is TRUE, then statment2 will be excuted and none of the others. If neither expression1 nor expression2 are TRUE then statement3 will be executed and none of the others. This series may be used as many times as you like with the general form of:
else if... else if... . . . else An example of the use of the else if is shown in the following program:
The above program compiles without errors. Here are some facts aout the program:
|
|