On Wednesday, 21 January 2026 at 14:44:05 UTC, Erdem wrote:
On Wednesday, 21 January 2026 at 00:08:32 UTC, Brother Bill wrote:
Is the mistake on my side or D's side?

The function's detail should be written by you.

void average(int[] a, int[] b)
{
        throw new UnequalLengths("Unequal lengths");
}

How can you determine the size of arrays passed to the function are not the same?

```d
int[] average(int[] a, int[] b)
{
    // ...
    int[] average;
    if (a.length != b.length)
        throw new UnequalLengths("Unequal lengths");
    return average;
}
```

This example is a toy.   In real code, would use your comparison.
The purpose is to throw new UnequalLengths("Unequal lengths");
And for the unit test to pass it.

My question is why isn't the unittest passing it?


Reply via email to