On 21.06.21 09:02, Mike Parker wrote:
On Monday, 21 June 2021 at 06:16:15 UTC, mw wrote:

Ha! great. I didn't know `~` works for both single elements and array!

`~` by itself is the concatenation operator and only works with two array operands. `~=` is the append operator and can append arrays or single elements.

`~` works just fine with single elements:

    void main()
    {
        import std.stdio;
        int[] a = [2, 3, 4];
        writeln(1 ~ a ~ 5); /* [1, 2, 3, 4, 5] */
    }

Reply via email to