Created
November 21, 2018 21:08
-
-
Save shanselman/52ee33c480f1bd21b284686818b14ea7 to your computer and use it in GitHub Desktop.
Fibb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
namespace FibonacciTest | |
{ | |
public static class FibonacciGenerator | |
{ | |
public static IEnumerable<int> Fibonacci() | |
{ | |
int current = 1, next = 1; | |
while (true) | |
{ | |
yield return current; | |
next = current + (current = next); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment