Proposal: yield each operator #8949
Replies: 1 comment
-
Duplicate of #378. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Consider adding yield each operator that iterates through a list/array/enumerable, yield returning each element.
Option 1
The syntax could be
This would simplify code to iterate through elements of a list. For example,
could be simplified to
If where clause is not needed, discard could be used
Option 2
The syntax could be
Using the same example as in option 1,
could be simplified to
This is also useful for recursive iterators, such as
could be simplified to
Beta Was this translation helpful? Give feedback.
All reactions