IDE bait and switch ;-)

Paul Dupuis paul at researchware.com
Sat Mar 26 11:26:37 EDT 2022


So I was doing some coding today and in the IDE as you type a keyword, 
the syntax options popup. You can arrow down to the one you want and 
press tab to have the code template for the syntax filled in.

I was typing a 'repeat for each..." loop when I notices the popup list 
of syntax options had a "... with index"! WOW, I thought, some new 
syntax was added to included an automatic counter variable with a 'for 
each' loop. This is great!

I could really use a syntax like "repeat for each line tLine in 
container with index" where "index" gets auto incremented for each loop.

I immediately opened the dictionary (LC 9.6.6) to check the syntax and 
usage and was surprised to find NO reference to the "with index" 
(apparent) syntax. Well, okay, sometime the Dictionary fails to get 
updated with the latest stuff, so I'll go back to the IDE and just try 
it! So I pick that syntax options and I get:

put 0 into tIndex
repeat for each line tLine in container
   add 1 to tIndex
   -- code
end repeat

Which, of course, is how we all do it.

While it is nice the IDE syntax feature kindly placed this whole code 
snippet, I feel like a "Bait and Switch" was just pulled on me! An now I 
really want LC, Ltd. to add a "with tIndex" syntax to the repeat for 
each loop structure!




More information about the use-livecode mailing list