If it equals?

Klaus Major klaus.major at metascape.org
Fri Aug 23 02:38:01 EDT 2002


Hi Trevor,

>
>> as usual, a repeat loop with "for each" will be incredibly faster.
>>
>
> Thanks for the tip Klaus.  I am still figuring out the optimal way to 
> handle things in the Revolution environment so tips like this are 
> greatly appreciated.

You're welcome.

But keep in mind that "for each" is just a "read only" thing.
Something i always forget, resulting in this funny sound
"splat" when your hand hits your forehead :-D

???

That means that you cannot do something like:

...
put fld 1 into the_field
repeat for each line EL in the_field
    if item 1 of EL is "xxx" then delete item 1 of EL
end repeat
put the_field into fld 1
...

does not work :-(

You have to script something like this instead:

...
put fld 1 into the_field
repeat for each line EL in the_field
    if item 1 of EL is "xxx" then put item 2 to -1 of EL & CR after EM
end repeat
dlete char -1 of EM ## strip the last CR
put EM into fld 1
...

I hope you get the picture...

This is still insanely fast ;-)

My experience:
More than 5000 loooong lines with lots of conditions (more than the 
simple "if...then"
in the above example) were processed in less than a second.
Love that :-)

> Trevor DeVore

Regards


Klaus Major
klaus.major at metascape.org




More information about the use-livecode mailing list