K-Meleon

Use this page to experiment with the wiki. (Just don't delete this text; otherwise people won't know the purpose of the page.)


Alternative conditional statements since version 1.5

   if (condition) { statement1; [statement2; [...]] } else { statementA; [statementB; [...]] } 

May have multiple conditions joined by 'and' or 'or'.                                                        

   if ((condition) and (condition)) { statement1; [statement2; [...]] } else { statementA; [statementB; [...]] }  
   if ((condition) or (condition)) { statement1; [statement2; [...]] } else { statementA; [statementB; [...]] }  

 

If the boolean expression in parentheses is true, the statements in the if block are executed. Otherwise the statements in the else block are executed. The else block is optional. Surrounding curly braces can be omitted for a block that contains only one statement.

Examples:

        if (condition) statement;

        if (condition) {
                statement1;
                statement2;
        } else {
                statement3;
                statement4;
        }

        if (condition) statement1; else statement2; statement3;

In the last example, statement3 is executed whatever the value of condition may be since the if-else statement is finished after statement2. If statement3 is meant to belong to the else block, statement2 and statement3 have to be enclosed in curly braces.

    while( CONDITION ) STATEMENT ;                                           Since version 1.0 

Executes a single STATEMENT while the CONDITION is true. To execute multiple statements, these have to be encapsulated in a helper macro:

    while( CONDITION ) &Loop;
Loop { ... }
    while( CONDITION ) { STATEMENT1 ; [STATEMENT2 ; [ ... ]] }    Since version 1.5

The syntax was extended to support execution of multiple statements.
May have multiple conditions joined by 'and' or 'or'.

while( (CONDITION) and (CONDITION) ) { STATEMENT1 ; [STATEMENT2 ; [ ... ]] } while( (CONDITION) or (CONDITION) ) { STATEMENT1 ; [STATEMENT2 ; [ ... ]] }

    while ( CONDITION ) { 
    STATEMENT1 ;
    STATEMENT2 ;
    }    
K-Meleon

(c) 2000-2010 kmeleonbrowser.org. All rights reserved.
design by splif.