commit 9ead25a41701d7f1e82b4b0d3fcd14b040faca64 Author: Archie Fox Date: Fri Jul 18 16:39:29 2025 +0300 Init commit diff --git a/8-struct/go.mod b/8-struct/go.mod new file mode 100644 index 0000000..bf7891f --- /dev/null +++ b/8-struct/go.mod @@ -0,0 +1,3 @@ +module struct + +go 1.24.4 diff --git a/8-struct/main.go b/8-struct/main.go new file mode 100644 index 0000000..a14c9fa --- /dev/null +++ b/8-struct/main.go @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("Глава 8 - Это struct") + + // var myStruct struct { + // number float64 + // word string + // toggle bool + // } + // fmt.Printf("myStruct - %#v\n", myStruct) + + type myType struct { + name string + age int + active bool + } + + person := myType{ + name: "Archie Fox", + age: 49, + active: true, + } + + // fmt.Printf("Person - %#v\n", person) + fmt.Println(person.name) +}