IN CASE YOU'RE HAVING TROUBLE WITH IT, TRY THIS: put ?? into theValue repeat with theValue = theValue+1 to theValue +100 IF theValue mod 20 = 0 THEN EXIT REPEAT end repeat put theValue
Joe Wilkins On Feb 18, 2012, at 3:55 PM, Joe Lewis Wilkins wrote: > Hi Marty, > > Just create a repeat loop that increases or decreases the value by 1 until it > reaches a value where mod 20 of the value = 0; then exit the loop and your > value will be divisible by 20. I'll let you code this. This would be very > fast and quite simple. > > Joe Wilkins > > On Feb 18, 2012, at 3:39 PM, Marty Knapp wrote: > >> Let's say I have a numeric field and a button to increase the value and a >> button to decrease the value. When I click the increase button, I want it to >> increase to the next highest value that is evenly divisible by 20. So if the >> field has a value of 19, a click will set the value to 20. If the field has >> a value of 121, a click would increase it to 140. >> >> I know I could do it by adding (or subtracting in the case of a decrease) >> but is there a more elegant and/or faster way to do that? >> >> Thanks, >> Marty K _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode