| 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 |
Compound StatementsCompound assignment statements are a way of combining several logical conditions and testing them. Doing this gives the programmer a great deal of power over the logical operation of the program.
Compound Statement Example The following compound assignment has two AND conditions connected with a single OR condition. ((expression1) && (expression2)) || ((expression3) && (expression4)) The above expression will be evaluatd to TRUE if expression1 AND expression2 are TRUE, OR, if expression3 AND expression4 are TRUE or both of AND expressions are TRUE. Otherwise it will be evaluated as FALSE.
Program Compound Statement Example As example of the use of a compound statement is shown in the program below:
The above program compiles without errors. Here are some facts about the program:
Where do we go from here? The next section introduces the use of the if else statement.
|
|