Index variable in MAP but not in FOR EACH

I saw this feature in a tweet by Jens that the map reporter can access the index:

And I couldn't find any mention of this in the manual.

But this would be nice for other list iterators. Eg. for each. The list library has

but it sure would be nice if the built-in for each could optionally access the index.

I think that the team like to encourage the use of HOF reporters vs command iterators so I suspect it'll remain out of sight in the library

Of course old dogs, like myself, that can't learn new tricks, use the command version all the time

There's a time to use the command, and a time to use HOFs. Some of the official libraries use the for each.

You can find what you want in the list utilities library.

I do agree that they should add an arrow at the beginning of the for each block that acts just like the input variables in the map block.

Command iterators have a place and time to be used, and it's annoying when you can't tell the index easily.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.