jarrodb revised this gist . Go to revision
1 file changed, 23 insertions
yo.go(file created)
@@ -0,0 +1,23 @@ | |||
1 | + | package main | |
2 | + | ||
3 | + | import "fmt" | |
4 | + | ||
5 | + | type Person struct { | |
6 | + | Name string | |
7 | + | Age int | |
8 | + | Country string | |
9 | + | } | |
10 | + | ||
11 | + | func main() { | |
12 | + | // Create a new instance of the Person struct | |
13 | + | p := Person{ | |
14 | + | Name: "John", | |
15 | + | Age: 30, | |
16 | + | Country: "USA", | |
17 | + | } | |
18 | + | ||
19 | + | // Access and print the fields of the Person struct | |
20 | + | fmt.Println("Name:", p.Name) | |
21 | + | fmt.Println("Age:", p.Age) | |
22 | + | fmt.Println("Country:", p.Country) | |
23 | + | } |
Newer
Older