Image bm160.GIF Multibranch Control Structure
Program Control
 
Image bm160.GIF heading of the multibranch structure
Image bm178.GIF branching term
Image bm179.GIF one branch for commands (can be used several times)
Image bm180.GIF one testing term (can be used several times)
Image bm181.GIF commands for branches not found
 
The multibranch control structure is used for branching a program into several parts depending on the term value. As a branching term any type of term can be utilized: a number, a flag, a text etc. Based on the branching term the program decides which command branch will be used. In the body of the branching structure one or more branches of commands may be used. The branches are searched from the top to the bottom. In each branch one or more testing term may be quoted (of the same type as the branching term). The terms are evaluated gradually from the top to the bottom. If a term is found which is identical with the branching term, the commands contained in the branch are executed, and the program continues running behind the end of the multibranch structure. If none of the terms corresponds to the branching term, the program continues in the following command branch. If no branch with a corresponding term is found, the commands for branches not found are executed.
 
Example of using:
 
Image bm182.GIF

Full Html Context Help of The Peter - Gemtree Software & Children Programming