diff --git a/arrays/arrays1.go b/arrays/arrays1.go new file mode 100644 index 0000000..7fac8b2 --- /dev/null +++ b/arrays/arrays1.go @@ -0,0 +1,10 @@ +package arrays + +import "fmt" + +func Demo1() { + var numbers [5]int + numbers[2]=50 // second index of the array + fmt.Println(numbers) + fmt.Println(numbers[2]) // will print second index of the array +} \ No newline at end of file diff --git a/main.go b/main.go index f31d81c..0828c6e 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "golesson/conditionals" "golesson/loops" "golesson/variables" + "golesson/arrays" ) func main() { @@ -12,4 +13,5 @@ func main() { fmt.Print() conditionals.Demo3() loops.Demo5() + arrays.Demo1() }