Switch Function [Runtime]/text/sbasic/shared/03090410.xhpSun Microsystems, Inc.converted from old format - fpeSwitch functionSwitch Function [Runtime]Evaluates a list of arguments, consisting of an expression followed by a value. The Switch function returns a value that is associated with the expression that is passed by this function.Syntax:Switch (Expression1, Value1[, Expression2, Value2[..., Expression_n, Value_n]])Parameters:The Switch function evaluates the expressions from left to right, and then returns the value that is assigned to the function expression. If expression and value are not given as a pair, a runtime error occurs.Expression: The expression that you want to evaluate.Value: The value that you want to return if the expression is True.In the following example, the Switch function assigns the appropriate gender to the name that is passed to the function:Example:Sub ExampleSwitchDim sGender As StringsGender = GetGenderIndex( "John" )MsgBox sGenderEnd SubFunction GetGenderIndex (sName As String) As StringGetGenderIndex = Switch(sName = "Jane", "female", sName = "John", "male")End Function