help switch                                                      also see:  if 
-------------------------------------------------------------------------------

Title

switch -- Specifiy corresponding values to evaluated cases (more efficient than consecutive if statements)

Syntax

switch {anything} , cases(string) values(string)

options Description ------------------------------------------------------------------------- cases(string) the possible cases given to {opth switch}, separated by a space. values(string) the matching values (in corresponding order) to the cases supplied, separated by a space.

Description

switch matches a given variable case to a given case-value set and stores the result (the matching value) in a local variable called switch_return. If no match is made, the local variable switch_return is set to (string) no_swatch.

Examples

--------------------------------------------------------------------------- . switch C, cases(A B C) values(20 30 40) switch matched C to a value of 40 --------------------------------------------------------------------------- . switch _8A, cases(_8A 50 _$_) values(1 2 3) switch matched _8A to a value of 1 --------------------------------------------------------------------------- . switch 100, cases(_8A 50 _$_) values(1 2 3) switch found no matching value for 100 ---------------------------------------------------------------------------