DEV Community

Discussion on: Zero Values and Complex Data Types In Golang

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