enum <TaggedUnionName> {
case <case name>(<FieldName> : <FieldType>, ...) // case syntax
}
package main
import fmt "fmt"
import strconv "strconv"
type Case343818345 struct {
diameter int
color string
}
type Case421059818 struct {
width int
height int
color string
}
type Case499594069 struct {
base int
width int
height int
color string
}
func main() {
fmt.Println("I only like red triangles. Let's see...")
myShape := map[int]any{499594069: Case499594069{base: 10, width: 5, height: 20, color: "red"}}
if _, exists := myShape[499594069]; exists {
if height, b := myShape[499594069].(Case499594069).height, myShape[499594069].(Case499594069).base; (func() bool {
return (myShape[499594069].(Case499594069).base == (b)) && (myShape[499594069].(Case499594069).height == (height)) && (myShape[499594069].(Case499594069).color == ("red"))
})() {
fmt.Println("It's a red triangle with a height of " + strconv.Itoa(height) + " and base length of " + strconv.Itoa(b) + "!")
}
}
if _, exists := myShape[421059818]; exists {
if width := myShape[421059818].(Case421059818).width; (func() bool {
return (myShape[421059818].(Case421059818).width == (width)) && (myShape[421059818].(Case421059818).color == ("red"))
})() {
fmt.Println("It's a red square with a width of " + strconv.Itoa(width))
}
}
if _, exists := myShape[343818345]; exists {
if diameter := myShape[343818345].(Case343818345).diameter; (func() bool {
return (myShape[343818345].(Case343818345).diameter == (diameter)) && (myShape[343818345].(Case343818345).color == ("red"))
})() {
fmt.Println("It's a red circle with a diameter of " + strconv.Itoa(diameter))
}
}
// Eliminates any 'unused variable' errors
_ = myShape
}