Skip to content

Instantly share code, notes, and snippets.

@shanselman shanselman/fibb.cs
Created Nov 21, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.