From 7f5e074730d0b3feb75fc6cb2795be0e61f0f8e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20G=C3=B6r?= Date: Sat, 20 Jan 2024 14:42:21 +0300 Subject: [PATCH] struct example 1 --- main.go | 2 ++ structs/demo1.go | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 structs/demo1.go diff --git a/main.go b/main.go index 10fba2d..af5adbe 100644 --- a/main.go +++ b/main.go @@ -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() } diff --git a/structs/demo1.go b/structs/demo1.go new file mode 100644 index 0000000..54a70af --- /dev/null +++ b/structs/demo1.go @@ -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 +} \ No newline at end of file