Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fibonacci Series
Message
From
20/07/2014 04:21:16
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Fibonacci Series
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01604182
Message ID:
01604182
Views:
70
A long time ago I wrote an IEnumerable to create a Fibonacci series - but lost it. Now I came up with this:
static IEnumerable<double> FibonacciSeries(int count)
        {
            double x = 0;
            double y = 1;
            for (int i = 0; i < count/2; i++)
            {
                yield return x = x + y;
                yield return y = x + y;
            }
        }
but I've a feeling that the old, lost, version was more concise. Anyone see a way of improving the above ?
Next
Reply
Map
View

Click here to load this message in the networking platform