Just signed up realizing that I couldn't modify the post without being a member.
Thank you for your help, SirRFI.
SirRFI wrote:what KeyDown := !KeyDown does is overwrite self with negated bool value (true becomes false, false becomes true). Keep in mind doing this to a false value (0) will end in true value (1, not what it originally was)
Now I understand that, but still not completely clear. I've spent an hour trying to understand what you wrote and testing a couple of thing on my own.
Looking at the sample code you wrote
Code: Select all
; 3 - true
; 3 - true
myVar := 3
MsgBox % myVar
; becomes 0 - false
myVar := !myVar
MsgBox % myVar
; becomes 1 - true
myVar := !myVar
MsgBox % myVar
and a little modification to it
#1
Code: Select all
; 3 - true
myVar := !myVar
MsgBox % myVar ;output is 1
myVar := !myVar
MsgBox % myVar ;output is 0
#2
Code: Select all
; 3 - true
myVar := !efgdr
MsgBox % myVar ;output is 1
myVar := !myVar
MsgBox % myVar ;output is 0
I guess myVar doesn't have any value before it's defined at the first line on
#1, so
!myVar doesn't have any value either, equivalent to 'not zero', hence resulting in TRUE. Similar logic goes to
#2
Is that correct?