Code: Select all
while(i??=0, i++, i<=5)
{
Msgbox(i)
}
Code: Select all
while(i??=0, i++, i<=5)
{
Msgbox(i)
}
I don't think its silly or useless, if it were to work...
Code: Select all
i := 0
while(i++ < 5)
{
Msgbox(i)
}
[v2.1-alpha.2+]: x ??= y is shorthand for x := x ?? y. y is evaluated and assigned to x only if x is unset. This provides a succinct way to initialize a variable, property or array/map element only if it didn't already have a value.
Nice... user defined counter, with step. Thanks!flyingDman wrote: ↑16 Sep 2023, 18:09see here: viewtopic.php?f=76&t=111881&p=539315#p539315 and the original post here: viewtopic.php?f=96&t=88725&p=511074&hilit=range#p511074
Thank @Descolada ! (I would'nt have been able to come up with that!! )andymbody wrote: ↑16 Sep 2023, 18:37Nice... user defined counter, with step. Thanks!flyingDman wrote: ↑16 Sep 2023, 18:09see here: viewtopic.php?f=76&t=111881&p=539315#p539315 and the original post here: viewtopic.php?f=96&t=88725&p=511074&hilit=range#p511074
Andy
Code: Select all
x := 10
while (x --> 0) ; x downto 0
msgbox x
Will do... me neither... I struggle to comprehend lambdas. I probably should try to use them more so they become familiar.flyingDman wrote: ↑16 Sep 2023, 18:45Thank @Descolada ! (I would'nt have been able to come up with that!! )
andymbody wrote: ↑16 Sep 2023, 17:48I don't think its silly or useless, if it were to work...
Generates an error for me (v2)
Missing operand.
Specifically: ??=0, i++, i<=5)
Should it work?
This workedCode: Select all
i := 0 while(i++ < 5) { Msgbox(i) }
Code: Select all
#requires Autohotkey v2.0
while(i := i ?? 0, i++, i <= 5)
{
msgbox(i)
}
Code: Select all
while x --> 0
Code: Select all
while (x--) > 0
Code: Select all
x := 100
while (0 <-- x) ; x downto 0
MsgBox x
Code: Select all
x := 100
while (0 <---------- x) ; x downto 0 but 5 times as fast
MsgBox x
No any «magic». Just a consistent decreasing of variable's value. Such as:
Code: Select all
while ( 0 < (--x, --x, --x, --x, --x) )