next up previous contents index
Next: Attributes for DO statements Up: Various attributes and functions Previous: Attributes for labels

  
Attributes for conditional statements

Conditionnal statements are coded by several variants:

The following attributes gives a quick access to the most useful parts of conditionnal statements.

  $\blacktriangleright$ stat.CONDITION
 
The   expression returns the condition associated to a conditionnal statement.
  $\blacktriangleright$ stat.THENCLAUSE
 
The   expression returns the THEN branch of the statement stat of variant "struct_if" or "struct_elseif".
  $\blacktriangleright$ stat.ELSECLAUSE
 
The   expression returns the ELSE branch of the statement stat of variant "struct_if" or "struct_elseif".

  $\blacktriangleright$ stat.STATEMENT
 
The   expression returns the statement associated to the statement stat of variant "log_if". (see section 8.1 for more informations).

$\vartriangleright$ Example 43:The following script inverts the condition and exchanges the branches of an IF-THEN-ELSE statement

       

 SCRIPT InvertIf() 
   stat := $cstat 
   IF (stat.VARIANT=="struct_if") THEN 
     stat.CONDITION <- PARSEEXPR(".NOT.(%e)",stat.CONDITION)
     thenpart := stat.THENCLAUSE 
     stat.THENCLAUSE <- stat.ELSECLAUSE     
     stat.ELSECLAUSE <- thenpart 
   ENDIF 
 ENDSCRIPT


next up previous contents index
Next: Attributes for DO statements Up: Various attributes and functions Previous: Attributes for labels
Yann Mevel
1999-04-30