
Function called, doesn't answer!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Function called, doesn't answer!
Nice catch Ross... maybe next time you'll realy outsmart the debugger. Keep trying! 

Re: Function called, doesn't answer!
This is the test stack I did to help me find that bug.
Doesn't do the important bit. Just updates the numbers
generated by the "HowMany30" and "WayBack" functions.
Click the "Go" button then "Add a Number" and if you
are quick you'll see (some) numbers changing.
Doesn't do the important bit. Just updates the numbers
generated by the "HowMany30" and "WayBack" functions.
Click the "Go" button then "Add a Number" and if you
are quick you'll see (some) numbers changing.
- Attachments
-
- SpinsSinceTest.zip
- (10.93 KiB) Downloaded 230 times
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.
Programming powered by coffee.
Re: Function called, doesn't answer!
Thanks. I had a look.
I tested the culprit loop repeat with x = -1 to -30, and as expected it didn't work.
In fact, repeat with x = A to B have two ways of "not working".
- It could hang for a while if LC did naively increment A until it reach B (=)
- It could return immediatly if LC check that A >= B beforehand
Looks like it's the second one. I learned something. Nice!
I tested the culprit loop repeat with x = -1 to -30, and as expected it didn't work.
In fact, repeat with x = A to B have two ways of "not working".
- It could hang for a while if LC did naively increment A until it reach B (=)
- It could return immediatly if LC check that A >= B beforehand
Looks like it's the second one. I learned something. Nice!
Re: Function called, doesn't answer!
[Repost. I try to do a better wording.]
Hi Ormente.
In the sense of your explanation:
repeat with x=A to B (meant as x=A up to B)
is, as RossG said, by LC interpreted as
repeat with x=A to B step 1
no matter the values of A and B
repeat with x= A down to B
is by LC interpreted as
repeat with x=A to B step -1
no matter the values of A and B
If we now set our own step-value, this setting gets precendence.
That's why
repeat with i=-1 to -30 step -1
works (counts from -1 down to -30)
[and similarly
repeat with i=1 down to 30 step 1
works (counts from 1 up to 30)]
Hermann
Hi Ormente.
In the sense of your explanation:
repeat with x=A to B (meant as x=A up to B)
is, as RossG said, by LC interpreted as
repeat with x=A to B step 1
no matter the values of A and B
repeat with x= A down to B
is by LC interpreted as
repeat with x=A to B step -1
no matter the values of A and B
If we now set our own step-value, this setting gets precendence.
That's why
repeat with i=-1 to -30 step -1
works (counts from -1 down to -30)
[and similarly
repeat with i=1 down to 30 step 1
works (counts from 1 up to 30)]
Hermann
shiftLock happens