Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Latest commit

 

History

History
7 lines (4 loc) · 650 Bytes

generators.md

File metadata and controls

7 lines (4 loc) · 650 Bytes

Generators

The yield keyword acts basically as yield return does in C#.

Python uses return for the equivalent of yield break, however that causes an inconsistency where removing yield from a method changes the meaning of the return. Adamant should use either yield break; or yield return; or something else.

Python has yield from for recursively yielding another iterator (Python already used from for other things). A paper proposed yield foreach for the same thing in C#. Adamant doesn't have a foreach or from keyword and isn't likely to get either. Options for this are yield for, yield from, and yield all.