yieldkeyword is used by generators, which provide a simple way to implement iterators without having to create a class that implements the
Iteratorinterface. A generator allows you to write code that iterates over a set of data without needing to build an array in memory that is returned at the end.
Want to add comments to your Statamic powered site? Try out Meerkat: a beautiful, full-featured comment system for Statamic. (sponsored link)
The power of yield
Posted on | Freek Van der Herten