A switch’s case must have a unique value. When repeated value is checked against the entire switch. The “duplicate case” error is arised. Let us discuss duplicate case error with the help of the examples:
./prog.go:15:10: duplicate case 4 in switch previous case at ./prog.go:13:10
./prog.go:15:8: duplicate case 0 in switch previous case at ./prog.go:12:8 ./prog.go:17:8: duplicate case 1 in switch previous case at ./prog.go:12:11
- Switch Case with Break in For Loop in Golang
- Golang | Deadlock and Default Case in Select Statement
- Switch Statement in Go
- How to use a switch case 'or' in PHP?
- Switch case in R
- Golang Program that uses String Switch
- Golang Program that switch on floating-point numbers
- Golang program that uses switch, multiple value cases
- Scala | Case Class and Case Object
- Golang Program that Removes Duplicate Elements From the Array
- Finding Complementary Error Function of Float in Golang
- Inverse Error Function of Given Number in Golang
- Finding Error Function of Given Number in Golang
- time.ParseError.Error() Function in Golang With Examples
- How to convert a string in lower case in Golang?
- How to check String for equality under Unicode case folding in Golang?
- Checking Slice of bytes for equality under Unicode case folding in Golang
- How to convert a slice of bytes in title case in Golang?
- How to Map a Rune to Title Case in Golang?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Akanksha_Rai