struct example 1

This commit is contained in:
Mert Gör 🇹🇷 2024-01-20 14:42:21 +03:00
parent e627044e4c
commit 7f5e074730
Signed by: hwpplayer1
GPG Key ID: 03E547D043AB6C8F
2 changed files with 15 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import (
"golesson/maps"
"golesson/pointers"
"golesson/slices"
"golesson/structs"
"golesson/variables"
)
@ -52,4 +53,5 @@ func main() {
numbers:=[]int{1,2,3}
pointers.Demo2(numbers)
fmt.Println("Numbers in Main", numbers[0])
structs.Demo1()
}

13
structs/demo1.go Normal file
View File

@ -0,0 +1,13 @@
package structs
import "fmt"
func Demo1() {
fmt.Println(product{"Computer", 5000, "XYZ"})
}
type product struct {
name string
unitPrice float64
brand string
}