You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See https://go.dev/ref/spec#Switch_statements. I'm going to close this for now, as expression switch statements already support these simple statements as pointed out above. If you want to file a different proposal, feel free to open a new one, but please read the spec carefully first.
Author background
Something between novice and intermediate
JS/TS, C#, Python
Related proposals
Has this idea, or one like it, been proposed before?
No
Does this affect error handling?
No
Is this about generics?
No
Proposal
This proposal adds short statement in switch, like in if statement
This proposal helps make switch code more shorter and nicer(?)
Switch now can include short statement, like in if, it's looks like this
Or like this, if there is no condition
What would change in the language spec?
Note about this short statement in switch
Is this change backward compatible?
Yes
Show example code before and after the change.
Before
Orthogonality: how does this change interact or overlap with existing features?
It's new feature
Is the goal of this change a performance improvement?
No
Costs
Would this change make Go easier or harder to learn, and why?
No
What is the cost of this proposal? (Every language change has a cost).
Adding this thing to language?
How many tools (such as vet, gopls, gofmt, goimports, etc.) would be affected?
gopls, vet(?), gofmt(?)
What is the compile time cost?
Zero
What is the run time cost?
Zero
Can you describe a possible implementation?
No
Do you have a prototype? (This is not required.)
No
The text was updated successfully, but these errors were encountered: