Skip to content

Instantly share code, notes, and snippets.

@shanselman
Created November 21, 2018 21:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanselman/52ee33c480f1bd21b284686818b14ea7 to your computer and use it in GitHub Desktop.
Save shanselman/52ee33c480f1bd21b284686818b14ea7 to your computer and use it in GitHub Desktop.
Fibb
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