Top "Yield" questions

yield is (1) a keyword that facilitates creation of generator functions, (2) a Ruby statement to transfer control from one coroutine to another, (3) a Java statement used to yield a value from a switch expression.

How can I traverse a file system with a generator?

I'm trying to create a utility class for traversing all the files in a directory, including those within subdirectories and …

python recursion iterator generator yield
What's the use of yield break?

Possible Duplicate: What does “yield break;” do in C#? Can anyone see a use for the "yield break" statement that …

c# yield iterator
What does 'yield' keyword do in flutter?

What does the yield keyword actually do in Dart?

flutter dart yield
Thread.Sleep or Thread.Yield

I have a method that uses a background worker to poll a DLL for a status looking something like this: …

c# multithreading sleep yield
In C#, why can't an anonymous method contain a yield statement?

I thought it would be nice to do something like this (with the lambda doing a yield return): public IList&…

c# yield anonymous-methods yield-return
The idiomatic way to implement generators (yield) in Golang for recursive functions

[ Note: I read Python-style generators in Go, this is not a duplicate of it. ] In Python / Ruby / JavaScript / ECMAScript 6, generator …

recursion go generator yield
C#: yield return within a foreach fails - body cannot be an iterator block

Consider this bit of obfuscated code. The intention is to create a new object on the fly via the anonymous …

c# iterator yield
What is the result of a yield expression in Python?

I know that yield turns a function into a generator, but what is the return value of the yield expression …

python generator yield
How does this class implement the "__iter__" method without implementing "next"?

I have the following code in django.template: class Template(object): def __init__(self, template_string, origin=None, name='&…

python iterator yield
SyntaxError: Unexpected Identifier (Generators in ES6)

I came up with this simple experiment after reading the documentation on generators from MDN: var nodes = { type: 'root', value: [ { …

javascript node.js generator yield ecmascript-harmony