Page 2 of 2

Re: Wrong true value of reference variable  Topic is solved

Posted: 12 Apr 2019, 22:18
by lexikos
"The rules of the distinction" is all-inclusive - there are no other rules, and no room for interpretation about this "fact". The original wording does not have this meaning.

The documentation literally says x, and you literally say y. Your inference that "y can't be false because x is true" is based on the unspoken false assumption that x == y. My point was that x != y.

Also, I updated the documentation prior to your reply, but you may have to force refresh.
An if-statement that contains an expression is usually differentiated from a traditional-if such as If FoundColor <> Blue by enclosing the expression in parentheses. However, this is not strictly required, as any if-statement which does not match any of the legacy if patterns is assumed to contain an expression. In particular, the following are also common ways of writing an if (expression):
  • Starting with an open parenthesis but not fully enclosing the expression: if (x > 0) and (y > 0)
  • Starting with a function call: if InStr(a, b)
  • Starting with an operator such as not or !: if !MyVar
Known limitation: For historical reasons, if (expression) actually accepts a Numeric Parameter rather than a pure expression. For example, if %MyVar% is equivalent to if MyVar. This can be avoided by always enclosing the expression in parentheses.