Math challenge thing

J. Landman Gay jacque at hyperactivesw.com
Sun Jul 30 14:03:14 EDT 2006


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.

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



More information about the use-livecode mailing list