Calculating Numbers

Scott Rossi scott at tactilemedia.com
Tue May 22 01:49:19 EDT 2007


Recently, kee nethery wrote:

>> start with a base number, say 75, and add
> 
> You mean base as in the starting number and not base as in base16 or
> base24 or base75?

Yes, a starting number.  Thanks for helping me clarify what I'm after.  I
looking to calculate the value to be added in each step to get from 75 to
255 in a predetermined number of steps.


> put 75 into theNum
> repeat with x = 18 down to 1
>     add x to theNum
>     if theNum > 254 then
>        exit repeat
>     end if
> end repeat
> put theNum

Unfortunately, this won't work as the goal is to end at a specified value
(in this case 255) and having the final step value equal to 1.  The number
of steps could change.

In other words, say I start with 75 and I know I want to have 30 steps
between 75 and 255 that get progressively smaller down to 1. How I determine
the value of each step?

Thanks & Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design





More information about the use-livecode mailing list