On Wed, Apr 24, 2019 at 8:42 PM David Koblas wrote:
> IMHO I've wanted a switch expression, rather than a switch statement for a
> while.
>
I've wanted that too, but what we already have really isn't that bad.
> value := switch test {
> case true => "red"
> case false => "blue"
> }
>
> value
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 .
Wow that was some bad typing + bad auto correct...
> On Apr 24, 2019, at 9:15 PM, Robert Engels wrote:
>
> Your original proposal did not have the colon and also implied the {} were
> mandatory. And what stops the sane syntax from. Ring nested ?
>
>> On Apr 24, 2019, at 6:28 PM, lgod...@gmail.
Your original proposal did not have the colon and also implied the {} were
mandatory. And what stops the sane syntax from. Ring nested ?
> On Apr 24, 2019, at 6:28 PM, lgod...@gmail.com wrote:
>
> Just to clarify : My original proposal was to include as part of Go the
> syntax
>
> (test) ? {
I don't think that's an answer to my comment. Was it intended to be?
lgodio wrote that they wanted ternary operators, but were not
advocating that it be possible to allow nested ternary operations. I
don't see how this is possible if you write the grammar as the only
sensible interpretation
TernE
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 wrote:
> How would you preclude it?
>
> On Wed, 2019-04-24 at 16:28 -0700, lgod...@gmail.com wrote:
> > I am NOT in favor of allowing nested ternary
How would you preclude it?
On Wed, 2019-04-24 at 16:28 -0700, 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 em