Switch Case

Navigation:  Language Reference > Statements >

Switch Case

Previous pageReturn to chapter overviewNext page

Syntax

switch variable

 case condition1 do

         equations;

 case condition2 do

         equations;

 default do

         equations;

end;

Description

The switch case statement is designed to execute equation(s) based on the condition of a variable. Only the equations of the valid branch are executed. If non of the branches is valid, the equations of the default branch are executed.

Limitations

1.The switch variable should not be changed inside one of the branches.
2.Equations within a switch case statement have to be written in the correct order of execution, i.e. they are not rewritten into a causal form but executed sequentially. Therefore it is advised only to use this statement in a code section.