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

Propose new features and changes
User avatar
SL5
Posts: 77
Joined: 12 May 2015, 02:10
GitHub: sl5net
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
SL5_AHK_Refactor_engine: viewtopic.php?f=22&t=8678 , online AHK prettyfy viewtopic.php?f=22&t=8678 , https://www.mikogo.com
TAC109
Posts: 176
Joined: 02 Oct 2013, 19:41

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 programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts

lexikos
Posts: 5407
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

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: Vh_ and 3 guests