Questions tagged as 'yield'

1
answer

What is Yield for?

For some time now I have written some basic scripts with Python, in some tutorials sometimes I get the yield , which usually appears in repetition structures commonly while . What is it for? And how to use?     
asked by 17.10.2015 / 01:11
3
answers

What is the difference between 'yield' and 'return' in PHP?

I've been trying to get that doubt out, but to no avail. At first glance they looked like similar commands or they would be the same thing. After seeing some explanations, I was a bit confused and did not take my doubts. If they are not the s...
asked by 13.01.2016 / 16:31
1
answer

What are the advantages of using a Generator (yield) in PHP?

Since PHP 5.5 was implemented in the Generator language. It can be used inside a function from the keyword yield . In the Manual , we have an example where one is compared to the function range(0, 1000000) (which theoretically...
asked by 10.02.2015 / 18:27
1
answer

Difference between yield and yield * operators in ECMAScript 6.0 "Harmony"?

I'm studying the use of generators in ECMAScript 6.0 "Harmony" . I have already been able to understand its basic operation, such as declaration through the function* () { ... } syntax and the production of values through the yie...
asked by 11.12.2013 / 20:01
1
answer

How to read / translate the keyword yield?

I am studying about the keyword Yield in C# , and I have this question: how to read this word in Portuguese (structured?). Is it something like "return the current value of the enumerator"? Would not it have a one-word translation...
asked by 09.03.2015 / 01:03
2
answers

Yield return within a using

Consider the following situation: public class MeuRecursoBemCaro : IDisposable { public T FazerOperacaoBemCara(T item) { //Do operação } public void Dispose() { //Dispose logi...
asked by 22.05.2014 / 20:43
2
answers

How to "simulate" a Generator in versions prior to PHP 5.5?

As of PHP 5.5 we can use yield instead of return in functions and, with that, we create Generators . The reasons for using yield can be seen here What are the advantages of using a Generator (yield) in PHP? But...
asked by 01.09.2015 / 17:42
1
answer

Yield does not return data

When executing the method call, an Enumerable of HTML components should be returned. I'm using the HTML Agility Pack to read an HTML file. The same method works as expected by removing yield and manually adding to a list HtmlNo...
asked by 02.11.2014 / 01:51
2
answers

Python reserved word yield

What's the difference between the following codes? def bottom(): yield 42 def bottom(): return (yield 42)     
asked by 24.06.2018 / 06:14