Re: Copying and array into another

2022-08-09 Thread pascal111 via Digitalmars-d-learn
On Tuesday, 9 August 2022 at 18:41:52 UTC, Paul Backus wrote: On Tuesday, 9 August 2022 at 18:33:04 UTC, pascal111 wrote: I tried to copy an array into another without affecting in the original array when I try to change the value of any element of the new array, but I failed except with this w

Re: Copying and array into another

2022-08-09 Thread pascal111 via Digitalmars-d-learn
Edit "Copying an array into another" in the title.

Re: Copying and array into another

2022-08-09 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 9 August 2022 at 18:33:04 UTC, pascal111 wrote: I tried to copy an array into another without affecting in the original array when I try to change the value of any element of the new array, but I failed except with this way in the next code: '''D int[] x=[1,2,3]; int[] y=x.fil

Copying and array into another

2022-08-09 Thread pascal111 via Digitalmars-d-learn
I tried to copy an array into another without affecting in the original array when I try to change the value of any element of the new array, but I failed except with this way in the next code: '''D int[] x=[1,2,3]; int[] y=x.filter!("a==a").array; y[1]=800; x.writeln; y.write