std.stdio.writeln
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Mar 9 07:42:34 PDT 2015
On Monday, 9 March 2015 at 14:38:41 UTC, Dennis Ritchie wrote:
> (1, 2, 3).writeln; // prints 3
that's not an array, use [1,2,3] for that.
What you wrote is a parenthesis expression with comma expressions
inside. The comma operator is a bit weird: it works like a
semicolon, but in different contexts.
So 1,2,3, in this context, means "calculate 1, then calculate 2,
then calculate 3, the result is the final one: 3". The 1 and 2
are just discarded because their calculations don't save anything
outside.
More information about the Digitalmars-d-learn
mailing list