Hi,

I'm building some functionality that relies on several arrays that need to be filled, checked and modified on the fly. I like the for-each loop with dim(*auto: nn) for this. In the initial load proces I can use '*next' as an index, which is great.
I couldn't find a way to get the current iteration index in a subsequent loop without holding track of it myself.

In simplified pseudo code:

"elements" has been filled in a previous loop and now needs to be updated.

for-each element in elements;
elemIndex += 1;
// do some checking
element.checked = *on;
// update element data
element.data = 'different';
elements(elemIndex) = element;
endfor;

I would like to get rid of elemIndex field and use something like this

elements(*current) = element

I couldn't find anything on this, except for questions on StackOverflow with people asking similar questions about other languages.

Am I overlooking something?


Kind regards



Martijn van Breden

lead software architect





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.