package main
import "fmt"
type car struct {
brand string
year int
}
func main(){
myCar := car{brand: "Ford", year: 2020}
fmt.Println(myCar)
}
Resultado:
{Ford 2020}
package main
import "fmt"
type car struct {
brand string
year int
}
func main(){
var otherCar car
otherCar.brand = "Ferrari"
otherCar.year = 2013
fmt.Println(otherCar)
}