# Switch Function

ααΆαβαααααβαααααΈβααβα’αΆαα»ααααα αα½αβααΆαβααααααβαααβααααβαααβαααααβαα½αβΒ α α’αα»αααα Switch αααα‘ααβαααααβαα½αβαααβααααΌαβααΆαβααααΆααβααΆαα½αβαααααα αααβααααΌαβααΆαβα α»αβαααβα’αα»ααααβαααΒ α

## ααΆαααβααααααα α

`Switch (Expression1, Value1[, Expression2, Value2[..., Expression_n, Value_n]])`

## αααΆαααΆαααααα α

α’αα»αααα Switch ααΆαβαααααβααααααβααΈβαααααβααβααααΆα α αΎαβαααααΆααβααβαααα‘ααβαααααβαααβααααΌαβααΆαβαααααβααβααααααβα’αα»ααααΒ α ααααα·αβααΎβαααααα αα·αβαααααβαα·αβααααΌαβααΆαβαααααβααΆβααΌ ααα α»αβαααβαααβαα½αβααΉαβααΎαβα‘αΎαΒ α

Expression α ααααααβαααβα’αααβαααβααΆαβαααααΒ α

Value α αααααβαααβα’αααβαααβαααα‘αα ααααα·αβααΎβααααααβαα·αΒ α

αααα»αβα§ααΆα αααβααΌαβααΆαβααααα α’αα»αααα Switch αααααβαααααβαααβαααβααααααβααβααααα αααβααααΌαβααΆαβα α»αβααβα’αα»αααα α

## Error codes:

5 ααΆαβα αβαααααβαα·αβααααΉαααααΌα

## α§ααΆα ααα α

`Sub ExampleSwitch`

`Dim sGender As String`

`    sGender = GetGenderIndex( "John" )`

`    MsgBox sGender`

`End Sub`

` `

`Function GetGenderIndex (sName As String) As String`

`    GetGenderIndex = Switch(sName = "Jane", "female", sName = "John", "male")`

`End Function`