I tried:

import std.stdio;
void main()
{
        int [5] vals = [1, 2, 3, 4, 5];
        writefln("A = %d, B = %d, C = %d, D = %d, E = %d", vals []);
}

but got thrown an exception that "%d is not a valid specifier for a range".

The Python equivalent to flatten a list works:

vals = [1, 2, 3, 4, 5]
print("A = {}, B = {}, C = {}, D = {}, E = {}".format(*vals))

Output:

A = 1, B = 2, C = 3, D = 4, E = 5

Question:

Can D's [] be made to work that way? I recently had to write custom 
functions since I had an array representing numerical fields and wanted to 
print them out with individual labels but I wasn't able to use a single 
writefln with sufficient specifiers for that purpose because of this 
limitation.

-- 
Shriramana Sharma, Penguin #395953

Reply via email to