The below code returns 0, but not the content of s
s:="1|2" Msgbox % s "`n" s == A_Blank
Looks like a bug to me because this works just fine
s:="1|2" b:=s==A_Blank Msgbox % s "`n" b
Best Answer just me , 01 August 2013 - 02:06 PM
The below code returns 0, but not the content of s
s:="1|2" Msgbox % s "`n" s == A_Blank
Looks like a bug to me because this works just fine
s:="1|2" b:=s==A_Blank Msgbox % s "`n" b
Scripts are written and tested using AHK_H 64w (unless otherwise specified).
CFlyout. EasyIni. Dynamic Label Execution (No Reload). Word Lookup.
s:="1|2" Msgbox % s "`n" s==A_Blank Msgbox % s "`n" (s==A_Blank)Think about why the latter in the above code works the way you think it should but the former doesn't and you'll see why this isn't a bug.
Hmm, ok. Yes, I definitely misunderstood the evaluation process. For this same reason, the difference is not immediately obvious to me. % forces an expression, but the parenthesis are distinguishing s==A_Blank from the rest of the expression?
Here's how I was parsing it in my mind:
Scripts are written and tested using AHK_H 64w (unless otherwise specified).
CFlyout. EasyIni. Dynamic Label Execution (No Reload). Word Lookup.
We have one expression with one operator (i.e. ==
). On the left side of the operator we have s "`n" s
which will be auto-concatenated to "1|2`n1|2" and compared with A_Blank
on the right side.
Prefer ahkscript.org for the time being.
Understood. That just shattered my entire universe (not really). Thanks!
Scripts are written and tested using AHK_H 64w (unless otherwise specified).
CFlyout. EasyIni. Dynamic Label Execution (No Reload). Word Lookup.
s "`n" s==A_Blank
, the expression has no way of knowing that you want to evaluate only s==A_Blank
. It sees everything on the left side of the ==
as the term to be evaluated, so in essence, there is no text; the entire expression is the evaluation.s "`n" (s==A_Blank)
, the expression knows what needs to be evaluated and keeps it independent of the rest of the expression until it has a result from the evaluation.1 + 2 * 3
intending to add 1 + 2
first to end up with 9
, your statement would fail because the order of operation doesn't allow that. But if you use (1 + 2) * 3
, the order of operation works as intended and you get 9
.
Thank you for taking the time to explain that in detail, Sinkfaze. That was an excellent explanation.
Scripts are written and tested using AHK_H 64w (unless otherwise specified).
CFlyout. EasyIni. Dynamic Label Execution (No Reload). Word Lookup.