Math challenge thing

Thierry Arbellot thierry.arbellot at laposte.net
Sun Jul 30 14:13:00 EDT 2006


On 2006, Jul 30, , at 20:03, J. Landman Gay wrote:

> I had to write a loop the other day that cycled around a list of 4 
> numbers. Usually when I need to do that, I like to use the following, 
> where x is the current number that I want to increase:
>
>   put (x mod 4)+1 into x
>
> This goes around and around, giving a value of x between 1 and 4. But 
> this time I needed to include zero. I need a series "0,1,2,3". No 
> matter how I tinkered, I couldn't get a zero out of it.
>
> I wrote it the long way: if x = 3 then put 0 into x
>
> But I got curious. Is there a way to do it the cool way? I'm a math 
> idiot so maybe it's easy.

put (x+1) mod 4 into x


>
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
>

Thierry Arbellot
www.tokitest.com




More information about the use-livecode mailing list