The switch$ keyword is used to control the flow of a script. The general form of a switch statement is as follows: switch (expression) { case string_value0: statement(s); break; case string_value1; statement(s); break; . . . case string_valueN; statement(s); break; default: statement(s); } Where expression is evaluated and subsequently compared to the following case values. If a case string_value matches the evaluated expression, the statement(s) associated with that case are executed. If no values match and a default statement exists, the statement(s) in the default case will be executed.
The switch$ keyword is used to control the flow of a script. The general form of a switch statement is as follows: switch (expression) { case string_value0: statement(s); break; case string_value1; statement(s); break; . . . case string_valueN; statement(s); break; default: statement(s); } Where expression is evaluated and subsequently compared to the following case values. If a case string_value matches the evaluated expression, the statement(s) associated with that case are executed. If no values match and a default statement exists, the statement(s) in the default case will be executed. switch$ is used ONLY for expressions that evaluate to a string value. Note: Unlike C/C++, the break statements in switches are superfluous. Torque Script will only execute matching cases and NOT automatically execute all subsequent cases. %tmp = "hi" ; switch$( %tmp ) { case "bye": echo( "bye" ); case "hi": echo ( "hi" ); }