Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fibonacci Series
Message
De
21/07/2014 11:07:40
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01604182
Message ID:
01604243
Vues:
39
>>>>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 :-}
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform