declare an object in Go
Code snippet on how to declare an object in Go
type Person struct {
Name string
Age int
}
joe := Person{"Joe", 25}
This code declares a new object called “Person” which has two properties: “Name” and “Age”. The type for the Name property is string, and the type for the Age property is int. The new object is assigned to the “joe” variable, and the name and age are given as “Joe” and 25, respectively. So, this object represents a person named Joe, aged 25.