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

Please support us!