switch statements

switch statements require you to exhaustively consider all relevant or possible inputs (if you don’t rely on default).

Interestingly, the notion that switch statements can require a default is reflective of the truth to the idea that when the stakes get high, we all fall back to our default level of training or function. This has global applications to our functionality and, by extension, the inputs (things,people/their methods,contexts) in our lives as well

  • neidu2@feddit.nl
    link
    fedilink
    arrow-up
    7
    arrow-down
    2
    ·
    edit-2
    10 months ago

    using regex to find the absolute value of a number:
    $number =~ s/-//;

    using regex to check if a number is odd:
    print “odd!\n” if (($number / 2) =~ /\./)

    …and generally abusing regex for weird stuff it wasn’t intended for, because the regex engine is surprisingly efficient.

    🌼 Just PERLy Things! 🌼