Instead of
Code: Select all
if EG is not number
EG = 6
Code: Select all
if EG is not number, EG = 6
Code: Select all
if EG is not number
EG = 6
Code: Select all
if EG is not number, EG = 6
Code: Select all
EG:= (eg~="^\d$"?EG:6)
Thanks, I hadn't. I'm finding that code you gave hard to grasp. Help says there should be a space on either side of the ? but I notice there isn't in your code.nnnik wrote:Have you heard about our awesome ternary operator?Code: Select all
EG:= (eg~="^\d$"?EG:6)
it's for compatibility reasons , as per help file. It's up to you if you put spaces or not. I prefer to put spaces..Help says there should be a space on either side of the ?
Code: Select all
MsgBox, % (Abs(var) != "") ? "Number" : "Not a number"
MsgBox, % (var+0 == var) ? "Number" : "Not a number"
Code: Select all
MsgBox, % (var ~= "^[-+]?\d+(\.\d+)?$") ? "Number" : "Not a number"
Users browsing this forum: No registered users and 54 guests