Origins of the D Programming Language

H. S. Teoh hsteoh at
Tue Dec 4 01:07:35 UTC 2018

On Tue, Dec 04, 2018 at 12:59:00AM +0000, Neia Neutuladh via Digitalmars-d wrote:
> On Mon, 03 Dec 2018 16:02:30 -0800, H. S. Teoh wrote:
> > Furthermore, it's not just off by 1, since i=1 is a redundant case.
> > The loop really ought to start with 2.
> factorial(0) is 1 because it's the product of an empty sequence.

No doubt, but the loop should start at 2 because the first two elements
of the sequence are 1, and it's a waste of computation to multiply that
by 1 yet again.


Without geometry, life would be pointless. -- VS

More information about the Digitalmars-d mailing list