array setting : Whats going in here?

claptrap clap at trap.com
Sat Oct 7 16:59:47 UTC 2023


On Saturday, 7 October 2023 at 00:49:39 UTC, H. S. Teoh wrote:
> On Sat, Oct 07, 2023 at 12:00:48AM +0000, claptrap via 
> Digitalmars-d-learn wrote:
>>
>
> When you write `foo[]` you're taking a slice of the array, and 
> in that case if the lengths of both sides of the assignment 
> don't match, you'll get a runtime error.

How did I not know that?? I'd always thought "foo[] = x" was just 
special syntax for setting all the elements to the same value.

Thanks.


More information about the Digitalmars-d-learn mailing list