• DudeDudenson@lemmings.world
    link
    fedilink
    arrow-up
    0
    arrow-down
    1
    ·
    11 months ago

    If condition then this else that vs this ?? that

    Which option do you think requires less time for a person to identify and understand?

    Sure if it’s just your own code do whatever comes natural to you but there’s a reason we don’t use these kind of logical operators in day to day speech is my point.

    Ive been a backend dev for 2 years now and I’ve never come across the ?? operator and every time I come across a ternary operator I have to Google in what order comes what.

    Not saying it doesn’t make the code more concise and less “noisy” but sometimes a simple if else statement just makes the code easier to mantain