Hacker News new | ask | show | jobs
by ts4z 1584 days ago
I agree with this. The limited location I find that I really miss ternary operations is initialization.

  v := if foo() {
    7
  } else {
    11
  }
But this means {} blocks now have values, which is weird in a C derivative. Of course, one could do

  v := func() int {
    if foo() {
      return 7
    } else {
      return 11
    }
  }()
but... that's kind of awful.