DEV Community

Cover image for Zero Values and Complex Data Types In Golang

Zero Values and Complex Data Types In Golang

Neel Modi on November 21, 2020

In the last blog, we talked about the Primitive Data Types of Golang. If you haven’t read it yet, first go read that blog. In that blog, in the end...
Collapse
 
dishantpandya profile image
Dishant Pandya

Example Code:

package main

import "fmt"

func main() {
    type car struct {
        wheels   int
        fuel     string
        capacity int
        brand    string
        name     string
    }
    fmt.Println(
        car{
            wheels:   4,
            fuel:     "diesel",
            capacity: 6,
            brand:    "kia",
            name:     "seltos",
        })
}

Enter fullscreen mode Exit fullscreen mode

Output:

go run main.go 
{4 diesel 6 kia seltos}
Enter fullscreen mode Exit fullscreen mode