The lack of a Go ternary operator is at odds with Go's major theme of clean and easy to read syntax. Those who choose not to use the ternary operator can always resort back to Go's current 'if -else' or 'case' syntax. So Go syntax suffers no negative impact by adding the ternary op to its syntax list. Those opposed to the ternary op should not be allowed to deny it use other Go programmers, that consider it useful.
On Wed, Apr 24, 2019 at 8:31 AM Robert Engels <reng...@ix.netcom.com> wrote: > That’s not what he meant. It takes 5 lines for a trivial assignment > if/else rather than 1 line with a ternary with no loss in readability. > > > On Apr 24, 2019, at 7:11 AM, Jan Mercl <0xj...@gmail.com> wrote: > > > >> On Wed, Apr 24, 2019 at 2:04 PM Mark Volkmann < > r.mark.volkm...@gmail.com> wrote: > >> > >> The idea of adding the ternary operator to Go has been debated many > times. It’s clear that those in charge have a strong dislike for it. For me > the lack of the ternary operator is one of main things I dislike about Go. > It’s nails on a chalkboard for me to write a five line “if” statement when > it could have been a one line assignment statement. > > > > That's a nice example why Go does not have the ternary operator. > > Fitting five if statements into one line makes the code probably > > unreadable just for the imaginary gain of saving some vertical screen > > space. > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.