Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fibonacci Series
Message
From
21/07/2014 11:07:40
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
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:
01604243
Views:
40
>>>>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 ?
>>>
>>>That's pretty concise and understandable right there.
>>
>>Gregory dug up the old one - they are very similar. Found several solutions online - but I like mine best :-}
>
>Why write software if you don't think it's any good? ;-)

Because I get paid for it :-}
Previous
Reply
Map
View

Click here to load this message in the networking platform