I don't really get it why my co-male dev does not like ternary operator as a shorthand operator for if/else statements.

  • 11
    Maybe they don't like Elvis.
  • 2
    I honestly had some getting use to them as well. It helped a bit in the beginning to write it as
    return something
    ? ok
    : someotherthing;
  • 12
    Why specifically male, do the female devs like them?
  • 5
    It's not as verbose, so it's difficult when you're not used to it.
  • 3
    @electrineer agreed. While writing, it's look like something good but while reading kind of break the flow.
    BTW I use it too.
  • 6
    Because it easily gets out of control into 7 levels deep pit of ternaries for a single return.

    It's okay to use it now and then, but anything more than that and code will soon enough become a pit of snakes
  • 2
    I find easy to miss it while I'm searching for a problem
  • 5
    To me, they are most suited for conditional assignment, otherwise I would use if else
  • 1
    I think it depends which language you're using. It's OK in js if the condition and the return values are simple but other languages make it too verbose for readability.
  • 10
    A single ternary is great. A nested ternary is the Great Satan.
  • 2
    Ternary in java is god sent . Ternary/Elvis in kotlin is outrageous . (Basically whole kotlin is , i hate kotlin)
  • 0
    @odite I didn't think about that. Lol.

    Anyway, there's an issue lately in our office, since I'm slightly triggered haha. This newly hired non dev (front-end dev's wife) has a MAJOR DRAMATIC ISSUE to me (the only dev babe lol) on how I approach to front-end guy. Well, I treat the team equally like normal devs and just take their green jokes like any other conversation, smiles to team, and get back to work. I don't know why I'm an eyesore to her.
    Probably why so.
  • 1
  • 0
    @electrineer @shiv7071007 okay. But, by just looking the whole condition it's just so understandable. Just used it for single ternary (@jkuhl) and yes, @theuser for conditional assignment.
    Anyway, I appreciate how co-dev improves a lot =)
  • 0
    @coffeeneia oh, he is a co-dev? I though he was a co-male.
  • 0
    @electrineer hahahahahaha. Right 😉
Add Comment