Quantcast
Channel: LiveCode Forums
Viewing all articles
Browse latest Browse all 440

Getting Started with LiveCode - Experienced Developers • Multiple istances of values in a repeat loop

$
0
0
Hello!
Given this code, somebody can explain me why the number "2" gets repeated twice?

CODE:

local sNumber = 2on mouseUp pMouseButton     put sNumber mod 2 + 1 into sNumber --alternate 1 and 2 at each press    MofifyTheRepeatend mouseUpOn MofifyTheRepeat     repeat 5          put sNumber & " " after msg          if sNumber = 2 then exit repeat          wait 3 seconds with messages     end repeat     beepend MofifyTheRepeat
How to do it:
- 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

Statistics: Posted by trevix — Wed Sep 04, 2024 5:48 pm



Viewing all articles
Browse latest Browse all 440

Trending Articles