looping and expressions

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

looping and expressions

26 Dec 2020, 22:44

Please consider this code:

Code: Select all

test = 2
loop, % test < 3 ? test : 0
soundbeep
This gives me three beeps and if test is greater than 3 one beep, not zero beeps. Can someone explain why, please. Thanks.
User avatar
lmstearn
Posts: 695
Joined: 11 Aug 2016, 02:32
Contact:

Re: looping and expressions

27 Dec 2020, 01:35

Code: Select all

test := 2
loop, % test < 3 ? test : 0
soundbeep
Gives two beeps here, all else is as expected. Still works with test as a string:

Code: Select all

test := "4"
loop, % test < 3 ? test : 0
soundbeep
and also with

Code: Select all

test = 3
loop, % test < 3 ? test : 0
soundbeep
What's the version of AHK over there?
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: looping and expressions

27 Dec 2020, 15:53

Thanks for the reply. I'm using version 1.1.33.02.
User avatar
mikeyww
Posts: 26971
Joined: 09 Sep 2014, 18:38

Re: looping and expressions

27 Dec 2020, 17:11

I wonder if you just forgot to save your script. I don't see how you could get three out of this. Here's another to test.

Code: Select all

test := 2
Loop, % test < 3 ? test : 0
 Send %A_Index%
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: looping and expressions

28 Dec 2020, 03:03

Sorry, it wasn't that I hadn't saved my scrip but rather that the script had an errant soundbeep hiding right at the top of the script and out of sight in my editor window. Thanks for the replies and myMy apologies for not double-checking my script before posting.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Araphen, DataLife, ShatterCoder and 232 guests