Problem with IF

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
foxhunter
Posts: 72
Joined: 04 Aug 2016, 04:27

Problem with IF

20 Nov 2016, 10:12

Sound strange, I don't understand the following behaviour:

Code: Select all

var := "test"

if var="test"     ; will NOT be executed
{
	msgbox IF1 statement executed
}	

if (var="test")   ; will be executed !!
{
	msgbox IF2 statement executed
}
I know, it's a matter of brackets, but in my mind both IF statements should work...
Has somebody a hint why brackets are needed (as when using numbers (e.g. var:=1) both works):

Code: Select all

var := 1

if var=1     ; will be executed !!
{
	msgbox IF1 statement executed
}	

if (var=1)   ; will be executed !!
{
	msgbox IF2 statement executed
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], nenyorp, Pianist and 136 guests