title: What is a "yield return" equivalent in the D programming language?
body: <p>Here is a simple generator in C#.</p>
  
  <pre><code>    IEnumerable&lt;int&gt; Foo()
      {
          int a = 1, b = 1;
          while(true)
          {
              yield return b;
              int temp = a + b;
              a = b;
              b = temp;
          }
      }
  </code></pre>
  
  <p>How do I write a similar generator in <em>Digital Mars</em> D?</p>
  
  <p>(The question is about the <em>yield return</em> statement)</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p>Update.
  That's interesting. Since I'm just generating a mathematical sequence, using <a href="http://www.digitalmars.com/d/2.0/phobos/std_range.html" rel="noreferrer"><strong>recurrence</strong></a> may be a good option. </p>
  
  <pre><code>auto fib = recurrence!("a[n-1] + a[n-2]")(1, 1);
  
  foreach (e; take(fib, 10)) // &lt;- prints first ten numbers from the sequence
  { 
      writeln(e); 
  }
  </code></pre>