I picked this trick up from someone along the way, on this list I believe, I've lost track of where it came from, so credit goes to someone else. You're right, Joe, commenting something as opaque as this (at least at first glance) is advisable, especially when you're sharing code. I can only plead that I wrote this at 11:30 PM after a 15 hour working day, so I was focusing only on getting it right, not on explaining it.
Long live the use-LC list! -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Feb 18, 2012, at 12:23 PM, Joe Lewis Wilkins wrote: > True Ken, but w/o comment it is much more difficult to know what is going on. > If you're going to use one liners like this, you'd better add some > commentary. One of the weaknesses I see in LC coding is the shortage of > comments. I realize that is a strong-point of LC; it is "almost" > self-commenting, but... > > > IMHO, > > Joe Wilkins > > On Feb 18, 2012, at 9:01 AM, Ken Ray wrote: > >>> function roundUp x >>> return trunc(x) + char itemoffset((x mod 1 > 0),"true,false") of "10" >>> end roundUp >> >> VERY clever, Peter! >> >> That's a great one-line variant to: >> >> function roundUp x >> put trunc(x) into tRetVal >> if x mod 1 > 0 then add 1 to tRetVal >> return tRetVal >> end roundUp >> >> :D >> >> Ken Ray >> Sons of Thunder Software, Inc. >> Email: k...@sonsothunder.com >> Web Site: http://www.sonsothunder.com/ >> >> _______________________________________________ >> 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 > > > _______________________________________________ > 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 _______________________________________________ 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