BTW, this construct is not very useful, it can only count the number of matches but cannot retrieve a pointer to the location or an index or build a list.
For simple types and complex algotihms it might not always be adecuate (depending on what you're doing) but I can assure you it's a gods-send when you're traversing lists of records or objects. For example, if you want to change some property of all components in a form, or modify strings in a StringList, or ... well, lots of things like that.
Of course, if you really need the index then a standard for...to loop must be used but when you care only for the accessed element (and not its position), for...in is a jwell to have. And it happens quite a lot ...
The problem is, you can
modify an object, but not the object variable, because an object variable is
implicitly a reference variable. You cannot
Create it, because for this you need to assign a new value to the object variable.
If an array or vector contains only plain records or plain datatypes, you get a
copy of the element and not a reference to it. In this case you cannot even modify it, because you will modify a temporary copy instead.
BTW, sorry if i often edit my posts, my english is not so good and almost always I see room for improvements later