Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Fibonacci Ienumerable

static IEnumerable<int> Fibonacci()
{
    int current = 1, next = 1;

    while (true)
    {
        yield return current;
        next = current + (current = next);
    }
}
Source by try.dot.net #
 
PREVIOUS NEXT
Tagged: #Fibonacci #Ienumerable
ADD COMMENT
Topic
Name
7+8 =