Index (keyword)
From RemObjects Software
The syntax for for each loops has been expanded in Oxygene to allow for an optional index variable to be defined, which will count from 0 through the number of elements looped. This is helpful in scenarios where the number of elements processed is needed as part of the loop, be it to access a separate collection by index, or to use different code to handle the first or even/odd elements.
When using for each matching or other mechanisms (such as Query Expressions) to filter down the collection, the index will only count those elements that actually execute the loop.
for each u in Users index i do begin if i > 0 then Console.Write(';'); // skip for first Console.Write(u.Name); end;
See Also
Product: RemObjects Oxygene (formerly known as Chrome)
Current version: 3.0
Previous Versions: 'Joyride' (2.0), 'Floorshow' (1.5), 'Adrenochrome' (1.0)
Glossary — Keywords — Language Features — Platform Features — Samples — Articles — How To — Issues
Categories: Text | Oxygene | Language | Keyword
