• starman@programming.dev
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    edit-2
    9 months ago

    IMO, it would be more readable to just use ifs most of the times. But switch-case fallthrough is indeed, interesting behaviour

    • NotNotMike@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      9 months ago

      Agreed, multiple if statements are much more readable, in my opinion. I generally think switch statements are always just a little too ugly unless their dead simple.

      Switch expressions, on the other hand, are gorgeous code (as long as you don’t use expression-bodied cases). I am always looking for chances to use switch expressions. So concise