...
The switch statement is an enhanced version of the if statement. Its syntax is the following:
Code Block switch (key1) { case val1: # block of rules;statements case val2: # block of rules;statements default: # block of rules }
Each The value of each the key given as argument to the switch statement is matched against the values specified in the case statements. If there is a match, then the block or rules statements corresponding to the matching case statement is are executed. Otherwise, the default case is executed. The default case is mandatory if the case statements do not cover all the possibilities. The "~" operator can be used to match "anything". Following is an example showing the use of the switch statement:
Code Block print 'processing paramId=[paramId] [shortName] [stepType]'; switch (shortName) { case 'tp' : set stepType='accum'; case '10u' : set typeOfLevel='surface'; default: }