MOD function does not work! So be warned!
Ian Summerfield
iansummerfield at btconnect.com
Thu Mar 28 17:55:01 EST 2002
The code I give here might look inefficient, the code comes from a large
project, so there are reasons for doing it this way!
It's just taken me several hours to figure out why my code wasn't working,
and it turns out to be a bug in Revolution.
Revolution 1.1.1b2 (OS X 10.1.3) seems to think 5 mod 5 = 5 whereas it is
zero.
Try this code:
on mouseup
put 235 into startPoint
put 255 into endPoint
put 0.1 into increment
put empty into msg
put startPoint into loop
repeat while loop<=endPoint
put loop && loop mod 5 & return after msg
add increment to loop
end repeat
end mouseup
It will output to the message box a list of numbers. The loop counter is on
each line followed by a space and the loop mod 5.
Here's my output:
235 0 <<<<---- correct
235.1 0.1
235.2 0.2
235.3 0.3
<<SNIP>>
240 5 <<<<---- wrong and impossible
240.1 0.1
240.2 0.2
240.3 0.3
<<SNIP>>
244.9 4.9
245 5 <<<<---- wrong and impossible
245.1 0.1
245.2 0.2
245.3 0.3
<<SNIP>>
250 5 <<<<---- wrong and impossible
250.1 0.1
250.2 0.2
250.3 0.3
<<SNIP>>
254.9 4.9
255 5 <<<<---- wrong and impossible
More information about the use-livecode
mailing list