MOD function does not work! So be warned!

Richard Gaskin ambassador at FourthWorld.com
Sun Mar 31 11:03:00 EST 2002


Ian Summerfield  writes:

> 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
...
> 255 5   <<<<---- wrong and impossible

Interestingly, when you type  "put 5 mod 5" (or "255 md 5" or other number
divisible by five that fails when inside a loop) into the Message Box the
result is 0.

Stranger still, if you rewrite the line like this so that the loop var is
evaluated outside of the rest of the statement:

  do "put loop &tab&"& loop &&"mod 5 & return after msg"

...you get 0.

What is it about loops that affects this so?

:\ 

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Custom Software and Web Development for All Major Platforms
 Developer of WebMerge 1.9: Publish any Database on Any Site
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com
 Tel: 323-225-3717                       AIM: FourthWorldInc




More information about the use-livecode mailing list