IMHO I've wanted a switch expression, rather than a switch statement for
a while.
value := switch test {
case true => "red"
case false => "blue"
}
or
value := switch item.(type) {
case int => item
case string => strconv.Atoi(item)
case time.Time => {
... something more involved ... returning an int
}
}
Sure, not as compact as ternary -- but far more powerful and useful.
On 4/24/19 9:40 PM, Michael Jones wrote:
switch test {
case true:
//..code block for test=true
case false:
//..code block for test=false
}
On Wed, Apr 24, 2019 at 4:42 PM Dan Kortschak <d...@kortschak.io
<mailto:d...@kortschak.io>> wrote:
How would you preclude it?
On Wed, 2019-04-24 at 16:28 -0700, lgod...@gmail.com
<mailto:lgod...@gmail.com> wrote:
> I am NOT in favor of allowing nested ternary operations
--
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
<mailto:golang-nuts%2bunsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
/Michael T. Jones
michael.jo...@gmail.com <mailto:michael.jo...@gmail.com>/
--
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
<mailto:golang-nuts+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
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.