May 21

On Friday, 21 May 2021 at 19:25:22 UTC, Ogi wrote:

>

On Friday, 14 May 2021 at 20:58:57 UTC, Dennis wrote:

>
void main() {
    int x = 3;
    string name = x switch {
        0 => "zero",
        1 => "one",
        2 => "two",
    };
}

This particular example can be emulated with this template:

template mapSwitch(alias map)
{

There's also std.algorithm.comparison.predSwitch in Phobos, which does something similar.

Next ›   Last »
1 2 3 4 5