三元运算符

控制流 / 条件语句 / if/else 语句

var n = -42
//Go doesn't have the ternary operator
var classify = (map[bool]string
    {true: "positive", false: "negative"})[n > 0]
//classify is "negative"