Structs

Part of Golang Mastery course

~15 min read
Interactive
Hands-on
Beginner-friendly

A struct is a collection of fields.

we are creating xy struct with X and Y fiels.

type xy struct { X string Y string }

Go Program

package main import "fmt" type xy struct { X string Y string } func main() { fmt.Println(xy{"x", "y"}) }

Your Progress

28 of 103 modules
27%
Started27% Complete
Previous
SpaceComplete
Next