Problem with IF

Get help with using AutoHotkey and its commands and hotkeys
foxhunter
Posts: 70
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”

Who is online

Users browsing this forum: Aaron0824, electrone77, RubbeH and 40 guests