On Sunday, 14 April 2019 at 11:44:16 UTC, Boris Carvajal wrote:
On Sunday, 14 April 2019 at 10:07:30 UTC, Andrey wrote:
Create some function in loop and use it. But I don't know how to mixin names?


import std.stdio;
void main()
{
     enum letters = ['A', 'B', 'C'];
     static foreach(ch; letters)
     {
mixin("void print" ~ ch ~ "(uint i) { writeln('" ~ ch ~ "', \" - \", i); }");
     }

     printA(1);
     printB(2);
     printC(3);
}

I want to mixin only name - not the full function code.

Reply via email to