|
sorry - but I have to disappoint you. Every language that I know, that has a "for-each" construct, assigns a copy of the actual array element to the loop variable.
If you want to modify arrays, you have to use the indexed form of FOR:
for index = 1 to %elem(array);
...
end-for;
Interesting question would be the question - does the RPG compiler and runtime guarantee that for-each is iterating for 1 to %elem()?
That question would be interesting, because other languages do not give any guarantee that "for-each" iterates the array elements in any particular order.
As an Amazon Associate we earn from qualifying purchases.
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.