понедельник, 2 декабря 2024 г. в 13:25:22 UTC+3, Karolina GORNA:
*switch-go/main.go*----------------------------------------------
package main
import "fmt"
func main() {
x := 10
switch x {
case 1:
fmt.Println("One")
case 5:
fmt.Println("Five")
case 10:
fmt.Println("Ten")
default:
fmt.Println("Other")
}
}
Karolina, in this specific test case the whole switch got optimized out, as
it's clear it always computes to 10, so only one case remains.
Andrey
--
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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/golang-nuts/d7b5996c-cb80-4a6b-9158-769fcbaba248n%40googlegroups.com.