common code patterns
MikeKerner at roadrunner.com
Thu Aug 10 17:15:25 EDT 2017
So back to my original question, and my original comment - you're talking
about macros? See my first reply.
On Thu, Aug 10, 2017 at 5:02 PM, Richard Gaskin via use-livecode <
use-livecode at lists.runrev.com> wrote:
> Monte Goulding wrote:
> > Sorry folks I should have been more specific and said using existing
> > syntax. So the original thing posted is what I’m after at the moment:
> > local tIndex
> > put 1 into tIndex
> > repeat for each line tLine in tLines
> > — code
> > add 1 to tIndex
> > end repeat
> Except that's wrong. :)
> I tend to use 0 as the initial value, and increment at the top of the loop:
> local tIndex
> put 0 into tIndex
> repeat for each line tLine in tLines
> add 1 to tIndex
> — code
> end repeat
> I've found two benefits from this habit:
> 1. (minor) Clearer distinction between unincremented and incremented
> 2. (major) I can "next repeat" at any point in the block and know that the
> counter is appropriately updated.
> Indeed, it was a runaway loop many years ago that set me know this path.
> All this raises a bigger question: can we for now provide some sparse
> minimums and perhaps consider adding more later if truly needed?
> Saves work for you folks, and obviates the need to have what would likely
> be really long threads here about different coding styles (or whether all
> possible styles should be supported in Prefs - "Damnation to the dangling
> 'thens'!" <g>).
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> Ambassador at FourthWorld.com http://www.FourthWorld.com
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
and did a little diving.
And God said, "This is good."
More information about the Use-livecode