A closing parenthesis as an option of continuation section

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kanat
Posts: 26
Joined: 22 Oct 2013, 01:35

A closing parenthesis as an option of continuation section

01 Dec 2014, 00:33

Since v1.1.01 a closing parenthesis may turn continuation section into an expression. Help file says, in order to do that, a closing parenthesis should appear in the line of options of the continuation section.
But I could not do that. If anybody used this feature, please leave your examples here.
kanat
Posts: 26
Joined: 22 Oct 2013, 01:35

Re: A closing parenthesis as an option of continuation secti

01 Dec 2014, 02:50

Very simple code:
Msgbox,
(
This
is
continuation
section
)
How to turn all the continuation section into expression by including closing ) in options line ?
User avatar
trismarck
Posts: 506
Joined: 30 Sep 2013, 01:48
Location: Poland

Re: A closing parenthesis as an option of continuation secti

01 Dec 2014, 08:19

Continuation section is sort of like a preprocessor - it adjusts the code _before_ a given line is recognized as a command / an expression.

Code: Select all

Msgbox, % b := "
(
This
is
continuation
section
)"
kanat
Posts: 26
Joined: 22 Oct 2013, 01:35

Re: A closing parenthesis as an option of continuation secti

01 Dec 2014, 13:17

Thanks for advice above, that is known for me, and information about preprocessing. But I asked for using a closing parethesis on options line of continuation section. It is a feature defined in the help document. As I understand, it should interprete a content inside a pair of parentheses as an expression.
kanat
Posts: 26
Joined: 22 Oct 2013, 01:35

Re: A closing parenthesis as an option of continuation secti

02 Dec 2014, 04:16

The code

Code: Select all

MsgBox, test
(x := 3)
Msgbox, %x%
works as well as this one (without parentheses)

Code: Select all

MsgBox, test
x := 3
Msgbox, %x%
I assume, possibly the option of a closing ")" does not work at all.
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: A closing parenthesis as an option of continuation secti

02 Dec 2014, 09:54

It was a demonstration of the use of it, not an explanation why you might want to use it.

Here's a demonstration where it might actually be useful:

Code: Select all

; Some code
(x > 3+4) ? CallFunc1() : CallFunc2()
; some more code
just me
Posts: 9482
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: A closing parenthesis as an option of continuation secti

02 Dec 2014, 10:13

Never noticed it and had to read the docs more than once:
) [v1.1.01+]: If a closing parenthesis appears in the continuation section's options (except as a parameter of the Join option), the line is reinterpreted as an expression instead of the beginning of a continuation section. This allows expressions like (x.y)[z]() to work without the need to escape the opening parenthesis.
It's not an option of a continuation section, though mentioned there.
kanat
Posts: 26
Joined: 22 Oct 2013, 01:35

Re: A closing parenthesis as an option of continuation secti

03 Dec 2014, 08:36

The code (x > 3+4) ? CallFunc1() : CallFunc2() works just like that x > 3+4 ? CallFunc1() : CallFunc2(). In this case parentheses enclosing the expression x > 3+4 are dispensable.
Anyway, I think, for more clarity in the help document, there would be better to appropiate the definition of a closing parenthesis on the subject of continuation section in “remarks” clause rather than in its options list.
User avatar
trismarck
Posts: 506
Joined: 30 Sep 2013, 01:48
Location: Poland

Re: A closing parenthesis as an option of continuation secti

04 Dec 2014, 06:08

I guess this could be another example:

Code: Select all

chicken := "aaaaaa" and 111 = "0x111"
;(chicken := "aaaaaa") and 111 = "0x111"
msgbox % chicken
kanat
Posts: 26
Joined: 22 Oct 2013, 01:35

Re: A closing parenthesis as an option of continuation secti

05 Dec 2014, 02:41

That's a good example. It lets see an effect of applying parentheses in expression.
mAny tHanKs !

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, gabelynn1 and 135 guests