| **Navigation:**  [[templates.htm|Templates]] > [[tlrcontents.htm|Template Language Reference]] > Complete Alpha Listing >====== #CASE (conditional execution structure) {{c6h0068.jpg|C6H0068.jpg}} ====== | [[ call insert code from a group without indention .htm|{{btn_prev_n.gif|Previous page}}]][[tlrcontents.htm|{{btn_home_n.gif|Return to chapter overview}}]][[ class define a formula class .htm|{{btn_next_n.gif|Next page}}]] | | || **#CASE(** //condition// **)** **#OF(** //expression// **)** [ **#OROF(** //expression// **)** ] //statements// [ **#ELSE** //statements// ] **#ENDCASE** {{blk2blue.jpg|blk2blue.jpg}} | **#CASE** | Initiates a selective execution structure. | | //condition// | Any Template Language expression which returns a value. | | **#OF** | The #OF //statements// are executed when the #OF //expression// is equal to the //condition// of the CASE. There may be many #OF options in a #CASE structure. | | //expression// | Any Template Language expression which returns a value. | | **#OROF** | The #OROF //statements// are executed when the #OROF //expression// is equal to the //condition// of the #CASE. There may be many #OROF options associated with one #OF option. | | **#ELSE** | The #ELSE //statements// are executed when all preceding #OF and #OROF //expressions// are not equal to the //condition// of the #CASE. #ELSE (if used) must be the last option in the #CASE structure. | | //statements// | Any valid executable source code. | | **#ENDCASE** | Terminates the #CASE structure. | A **#CASE** structure selectively executes //statements// based on equivalence between the #CASE //condition// and one of the #OF or #OROF //expressions//. If there is no exact match, the //statements// following #ELSE are executed. The #CASE structure must be terminated by **#ENDCASE**. If there is no #ENDCASE, an error message is issued during Template file pre-processing. #CASE structures may be nested within other #CASE structures. **Example:** ** ****#CASE****(%ScreenField)** **  #OF('?Ok')** **    #INSERT(%OkButtonGroup)** **  #OF('?Cancel')** **  #OROF('?Exit')** **    #INSERT(%CancelButtonGroup)** **  #ELSE** **    #INSERT(%OtherControlsGroup)** ** ****#ENDCASE**