Reputation: 137
I know this is stupid simple, but it doesn't work.
Somehow I would like to shorten this variable using an operand but whatever . Can someone please show me a shorthand way writing this code?
var := "abc"
if (var = "abc" or var = "def" or var = "ghi")
{
MsgBox Yes
}
else
msgbox No
Return
IE: if var = ABC|DEF|GHI
also can I shorten the code to one line?
Upvotes: 0
Views: 163
Reputation: 3366
This is functionally equivalent to your code in one line:
msgbox % var ~= "^(abc|def|ghi)$" ? "Yes" : "No"
Upvotes: 1