Init commit
This commit is contained in:
3
8-struct/go.mod
Normal file
3
8-struct/go.mod
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module struct
|
||||||
|
|
||||||
|
go 1.24.4
|
||||||
31
8-struct/main.go
Normal file
31
8-struct/main.go
Normal file
@@ -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)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user