From 86e0708f5a90a1eda2d82af54dc8affa316b9735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20G=C3=B6r?= Date: Wed, 10 Jan 2024 17:05:43 +0300 Subject: [PATCH] slice example --- main.go | 4 +++- slices/demo1.go | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 slices/demo1.go diff --git a/main.go b/main.go index 33da0b7..7d73145 100644 --- a/main.go +++ b/main.go @@ -2,10 +2,11 @@ package main import ( "fmt" + "golesson/arrays" "golesson/conditionals" "golesson/loops" + "golesson/slices" "golesson/variables" - "golesson/arrays" ) func main() { @@ -14,4 +15,5 @@ func main() { conditionals.Demo3() loops.Demo5() arrays.Demo4() + slices.Demo1() } diff --git a/slices/demo1.go b/slices/demo1.go new file mode 100644 index 0000000..b2f35ac --- /dev/null +++ b/slices/demo1.go @@ -0,0 +1,14 @@ +package slices + +import "fmt" + +func Demo1() { + names := make([]string, 3) + + fmt.Println(names) + names[0]="Engin" + names[1]="Derin" + names[2]="Salih" + + fmt.Println(names) +} \ No newline at end of file