See the example below.
- The 1st method works fine.
- The 2nd method doesn't work, despite the condition haven't changed. It doesn't work because there is no ( after if.
- The 3rd method works again, because the issue was fixed by enclosing entire condition inside ().
- But the 3rd method is ugly and also is inconsistent with forced expressions in commands (msgBox % "Something"). I tried the 4th method - it works, it looks better and is consistent with forced expressions in commands. But I never seen this method before.
Code: Select all
; To test this script, uncomment one of these 2 lines:
var1 := "foo", var2 := "bar"
;var3 := "baz"
; And then, uncomment one of these 4 methods:
if (var1 = "foo" && var2 = "bar") || var3 = "baz"
;if var3 = "baz" || (var1 = "foo" && var2 = "bar") ; Illegal, doesn't work
;if (var3 = "baz" || (var1 = "foo" && var2 = "bar"))
;if % var3 = "baz" || (var1 = "foo" && var2 = "bar") ; Works, but I never seen it before
msgBox % "Success"