Say I have a group of numbers 23,56,128,567 and I have to apply a conditional logic in which if a variable myData
exists in the above group of numbers then only I proceed, otherwise I don't.
Sorry, have to look into some legacy code and not exactly sure how to do it in VBScript.
You could put the values in a Dictionary
:
Set list = CreateObject("Scripting.Dictionary")
list.Add 23, True
list.Add 56, True
list.Add 128, True
list.Add 567, True
and then check if your value exists in the dictionary:
If list.Exists(myData) Then
'do stuff
End If
An ArrayList
would be another option:
Set list = CreateObject("System.Collections.ArrayList")
list.Add 23
list.Add 56
list.Add 128
list.Add 567
If list.Contains(myData) Then
'do stuff
End If
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With