Hacker News new | ask | show | jobs
by Supermancho 2263 days ago
> Most people treat switch as a peculiar form of match (or cond or whatever)

Completely made up switch illustrates how I use it in every language if I can...Go has a succinct version of this.

    switch(True) {
        case ($x == 1):
            $x++;
            break;
        case ($x > 3):
            $x--;
            break;
        default:
            break;
    }
1 comments

Why? It's longer, more complex, and more highly indented than a normal if-elif-else.