On Tuesday, 11 June 2024 at 09:17:21 UTC, madwebness wrote:
While I do understand what you're saying, I'm not sure I
understand how to fix the code.
With the following function definition what the function returns
is correct and the problem is in the unittest code. Note that
`writeln()` prints what's expected here program fails only when
it gets to `assert()`:
```
auto sliceIt(string[] words_arr) {...};
unittest {
auto words = ["HELLO", "world", "hi", "ENDOFTHERUNWAY"];
auto resulting_arr = sliceIt(words);
writeln(resulting_arr[0]); // => "world"
assert(resulting_arr[0] == "world"); // => ERROR mentioned in
(3) in the previous post.
}
```