- For your example, mm = 1, I wouldn't use quotes. Although mm = "1", would also work in that particular example.
- Here's an example where quotes matter. If at least one item has double quotes, or string content that doesn't look numeric, a string comparison is done.
Code: Select all
q:: ;text compare numeric/string
MsgBox, % (01 = "1") ;0
MsgBox, % (01 = 1) ;1
vNum := "01"
MsgBox, % (vNum = "1") ;0
MsgBox, % (vNum = 1) ;1
vNum := "01"
MsgBox, % ("" vNum = "1") ;0
MsgBox, % ("" vNum = 1) ;0
return
- There is a difference in how AHK v1/v2 handle strings/numbers. I believe it works like this: numbers are stored as numbers and strings in AHK v1, however, in AHK v2, it's either/or. E.g. if you define
var := 0xF in AHK v2, this is immediately converted to
var := 15, there is no trace of the original appearance of the number as 0xF:
Code: Select all
;AHK v1
vNum := 1.1
MsgBox, % InStr("1.1", vNum) ;1
MsgBox, % vNum ;1.1
vNum := 0xF
MsgBox, % InStr("0xF", vNum) ;1
MsgBox, % vNum ;0xF
;AHK v2
vNum := 1.1
MsgBox(InStr("1.1", vNum)) ;0
MsgBox(vNum) ;1.1000000000000001
vNum := 0xF
MsgBox(InStr("0xF", vNum)) ;0
MsgBox(vNum) ;15