From d265f189baf71741a4557471cee8cfd61591e6a8 Mon Sep 17 00:00:00 2001 From: Jyoti Singla <56391719+jyotisingla08@users.noreply.github.com> Date: Sat, 23 Oct 2021 13:36:31 +0530 Subject: [PATCH] Create array.go Array handling --- GO/array.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 GO/array.go diff --git a/GO/array.go b/GO/array.go new file mode 100644 index 0000000..7c5c381 --- /dev/null +++ b/GO/array.go @@ -0,0 +1,22 @@ +package main + +import "fmt" + +func main() { + +// Creating an array of string type +// Using var keyword +var myarr[3]string + +// Elements are assigned using index +myarr[0] = "GFG" +myarr[1] = "GeeksforGeeks" +myarr[2] = "Geek" + +// Accessing the elements of the array +// Using index value +fmt.Println("Elements of Array:") +fmt.Println("Element 1: ", myarr[0]) +fmt.Println("Element 2: ", myarr[1]) +fmt.Println("Element 3: ", myarr[2]) +}