On Monday, 12 October 2015 at 15:39:15 UTC, TheFlyingFiddle wrote:
How does this compile?

{
    string str = "hello";
    foreach (n; [32, 119, 111, 114, 108, 100, 33]) str ~= n;

    import std.stdio : writeln;
    str.writeln;            // prints "hello world!"

    writeln(true == 1);     // true
    writeln(false == 0);    // true

    string str2 = str.dup;

    str ~= 0;
    str2 ~= false;
    writeln(str == str2);   // true

    str ~= 1;
    str2 ~= true;
    writeln(str == str2);   // true
}

Reply via email to