• lowleveldata@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    ternaries are usually more flexible than switches

    Which is bad for readability because the reader need to manually compute it to see whether it’s doing simple switching or not. Also it adds the question of “Why did the author use a nested ternary instead of a switch? Was it meant to do more but it got left out unintentionally?”