compact if's

Propose new features and changes
ToKa
Posts: 26
Joined: 23 Apr 2016, 04:37

compact if's

20 Jun 2016, 03:53

Code: Select all

Make a wish, ok i got one
how about making if statements more compact like:

if (a > 10) {b=0} else {b=1}

wouldnt this be nice if it where legal. :thumbup:  
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: compact if's

20 Jun 2016, 04:02

For your example use Ternary
b := (a > 10) ? 0 : 1

Otherwise see here => One line while loop (similar to if)
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
ToKa
Posts: 26
Joined: 23 Apr 2016, 04:37

Re: compact if's

20 Jun 2016, 06:18

thanks jNizM, forgot about, that one would work in this instance.
maybe i could have picked a better example.
Just in general i like compact one liners where it is appropriate,
helps readability to not having to scroll through several pages
to comprehend a scripts actions.
Autohotkey is awesome.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: compact if's

20 Jun 2016, 22:48

It certainly is a poor example... ;)

b := (a <= 10)
User avatar
SnowFlake
Posts: 368
Joined: 28 Apr 2015, 05:41
Contact:

Re: compact if's

21 Jun 2016, 13:50

"poor example" xD lol
:yawn:

Return to “Wish List”

Who is online

Users browsing this forum: niCode and 28 guests