An example of a struct in Go
This is an example Go program showing a struct
.
package main import ( "fmt" ) type T struct { name string value int } func main() { var puppy T puppy.name = "Pinky" puppy.value = 100; fmt.Println(puppy) }
The output of the example looks like this:
{Pinky 100}
Copyright © Ben Bullock 2009-2024. All
rights reserved.
For comments, questions, and corrections, please email
Ben Bullock
(benkasminbullock@gmail.com).
/
Privacy /
Disclaimer