News for hackers. Stuff that matters.
Re:My Go Resolutions for 2017 by junke on Thursday January 19, 2017 @09:09AM (#13435827)
Go has a ternary if, but the syntax is weird ;-)

    n := map[bool]func() int{
            false: func() int { return falseExpr },
            true:  func() int { return trueExpr },
    }[expr]()

https://play.golang.org/p/TXIse32WD9

Now, let's see how to abstract it with "go generate"...

There are no comments on this comment yet.