Introduction

Struct is a collection of fields of data with declared data types. Golang has the ability to declare and create its own data types by combining one or more types, including built-in and user-defined types. user.

Structs are the only way to create user-defined types. Structure types are declared by composing a fixed set of fields.


type MyStruct struct {
    field1 string
🇧🇷

func (MyStruct) Method() {...}
                        
introduction.go