On Wednesday, 7 February 2024 at 20:13:40 UTC, Gary Chike wrote:
On Wednesday, 7 February 2024 at 20:08:24 UTC, Gary Chike wrote:
On Wednesday, 7 February 2024 at 19:32:56 UTC, Gary Chike wrote:

    double c = (double)sumArray(a, aLength) / aLength;

If I don't cast explicitly:

`double c = sumArray(a, aLength) / aLength;`

then I will get a similar result as the D code:

`Average: 9223372036854773760.00`

I don't think it's productive to compare the behavior to C. C is now 50 years old. One would hope that D has learned a few things in that time.

How many times does the following loop print? I ran into this twice doing the AoC exercises. It would be nice if it Just Worked.
```
import std.stdio;

int main()
{
  char[] something = ['a', 'b', 'c'];

  for (auto i = -1; i < something.length; ++i)
        writeln("less than");

  return 0;
}
```

Reply via email to