Printing an std.container.Array

Panke via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 16 13:09:49 PDT 2015


On Thursday, 16 April 2015 at 19:55:53 UTC, Bayan Rafeh wrote:

> How am I supposed to interpret this?

The array contains two elements. The first equals one and the 
second equals two.

What happens under the hood is that Array does no provide a 
toString method, instead a default is used. This results in your 
first output. For ranges - and the slice of the array is a range 
while the array is not - writeln prints the elements as a special 
case which leads to your second output.


More information about the Digitalmars-d-learn mailing list