Given this code, somebody can explain me why the number "2" gets repeated twice?
Code: Select all
local sNumber = 2
on mouseUp pMouseButton
put sNumber mod 2 + 1 into sNumber --alternate 1 and 2 at each press
MofifyTheRepeat
end mouseUp
On MofifyTheRepeat
repeat 5
put sNumber & " " after msg
if sNumber = 2 then exit repeat
wait 3 seconds with messages
end repeat
beep
end MofifyTheRepeat
- run mouseup once
- run it again after a few seconds
EXPECTED RESULT: on the second press, only one "2" should appear on the msg
OBSERVED RESULT: two occurences of the "2" appear on the msg.
Is there a way to avoid this?
Thanks