if(...).... in ohne line

Propose new features and changes
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
Contact:

if(...).... in ohne line

16 Jul 2017, 10:43

I was surprised when I accidentally discovered this very strange behavior. On an unware statement nevertheless commandos. Later I realized that it was probably because it was all in one line. Other programming languages are no problem. An error message has it also nciht. I will now have to examine my other scripts.

the following lines works like a true condition:

if(false)lll...
if(0)lll...

follwong works like false (like expected):

if(false)
lll...
if(0)
lll...

with regex you could find it with:
^[ ]*if[ ]*\([^()]+\)[^{\s]+

used
AutoHotkey_1.1.26.01_setup.exe
TAC109
Posts: 1111
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: if(...).... in ohne line

17 Jul 2017, 00:57

The IfEqual, IfNotEqual, etc commands can have another command on the same line - see the help documentation for details.
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: if(...).... in ohne line

17 Jul 2017, 02:34

(false) lll is a legitimate expression which concatenates the variables false (containing 0) and lll.

The condition of an IF statement is not required to be enclosed in parentheses. It is just a convenient way of disambiguating between IF-expression and the other types of IF statement, since expressions always allow parentheses and the other types of IF do not.
On an unware statement nevertheless commandos.
...

What? I'm guessing that was mistranslated.

Return to “Wish List”

Who is online

Users browsing this forum: gongnl and 19 guests