package main
import "fmt"
type englishScoreType int
type mathScoreType int
func showResult(score any) {
if v, ok := score.(englishScoreType); ok {
if v >= 80 {
fmt.Println("Pass!")
} else {
fmt.Println("Fail...")
}
return
}
if v, ok := score.(mathScoreType); ok {
if v >= 80 {
fmt.Println("Pass!")
} else {
fmt.Println("Fail...")
}
return
}
fmt.Println("Invalid score!")
}
func main() {
englishScore := englishScoreType(90)
mathScore := mathScoreType(50)
showResult(englishScore)
showResult(mathScore)
showResult("OK")
}