Switch with dynamic case

Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 2 06:07:13 PST 2016


import std.stdio;
import std.typetuple : TypeTuple;

alias cs = TypeTuple!(0, 1, 2, 3);

void main(string[] argv)
{
     switch(argv.length)
     {
         default: writeln("Uknown number of args"); break;
         foreach(c; cs)
         {
             case c: writefln("%s args", c);
             break;
         }
     }
}

This works, but I dont know why or how, is there some 
documentation about this feature?


More information about the Digitalmars-d-learn mailing list