Regarding writefln formatting

bearophile bearophileHUGS at lycos.com
Tue Mar 20 18:32:32 PDT 2012


> import std.stdio;
> void main() {
>      auto mat = [[1, 2, 3],
>                  [4, 15, 6],
>                  [7, 8, 9]];
>      writefln("[%([%(%2d, %)],\n %)]]", mat);
> }
>
>
> That outputs:
>
> [[ 1,  2,  3],
>   [ 4, 15,  6],
>   [ 7,  8,  9]]

Sorry, the dlang forum online interface has added an extra 
leading space on only certain lines.

I use 4 spaces indents in such code.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list