Go: Structures

Defining a Structure

Syntax:

type struct_variable_type struct {
   member definition;
   member definition;
   ...
   member definition;
}

Example:

 type Address struct {
      name string 
      street string
      city string
      state string
      Pincode int
}

Or

type Address struct { name, street, city, state string Pincode int }

Leave a Reply

Your email address will not be published. Required fields are marked *