Scripting what should be a simple loop...

Richmond richmondmathewson at gmail.com
Sat Jul 10 04:56:53 EDT 2010


On 07/10/2010 11:49 AM, Mark Schonewille wrote:
> David and Mark,
>
> Yet, repeat for each rules. Whether using arrays is faster than using 
> regular variables depends on whether your repeat loop is written smartly.
>

Quite; but that looks a bit like circular logic.

Everytime I have to write some sort of loop I get out the plastic cups 
and the beads
and play with them on the floor (preferably with a cup of coffee and 
some music)
until I find what I would term the most "economical" way of doing things.

So; prior to writing anything "smartly" one has to work out the 
'smartist' logic;
if you are incredibly good at abstractions you can do that mentally; if 
not you
can do it with a pencil and paper, or with cups and beads - whatever works
for you. LEGO is also quite effective.

Then; having worked out one's model; one has to represent it in code.

If one's model has already been worked out (squares and arrows on paper,
cups and beads on the floor, circles and lines on a blackboard) visually it
is, generally, easier to track where things go wrong with one's code by
comparing it with one's physical model.



More information about the use-livecode mailing list