Skip to main content

Creating Dynamic resizable array in Go Lang

If you are coming from Java or .net background, you must be familiar with the fact that collection framework are the backbone and handy for us.





You must be wondering that there is no collection framework in Go Lang and wondering how to do the same process which you have been doing in other language.





Resizable arrays are there for rescue.





package main

import "fmt"

func main()

myArr:=[]string
myArr=append(myArr,"Rajesh")
myArr=append(myArr,"Iswarya","Nishesha","Vishwesh")
fmt.Println(myArr)






Initially we declare an empty array of String





Then we append the values as we need and there we go





Official Documentation says as below





Comments

Popular posts from this blog

Motivational Letter for Visa

 Motivational Letter for Visa To, The visa officer  XXXXXXXXXXXX From, XXXXX XXXXXXXXXXXXX Subject: Request for XXXX tourist Visa - Reg.   I am <YOU_NAME> holding Indian Passport ( No. <PASSPORT_NO>.  I would like to visit <PLACE> for a tourist vacation as a tourist along with my family, details given below. I have also enclosed my own financial papers, hotel bookings and flight ticket for your perusal. I will abide to the terms and conditions of the visa regulations and will return to my home country before my stipulated visa duration period. I am planning to travel on  < DATE MOTH YEAR> and return on <DATE MONTH YEAR > . The flight ticket and other travel expenses will be borne by me.    NAME DOB PASSPORT NO ISSUE DATE EXPIRY DAT...

South Korea Places to Visit

 South Korea Places to Visit Gyeongbokgung Palace National Folk Museum Myeong-dong Hanok village               Changdeokgung Palace      Seoul Tower - on Namsan Hill   Dongdaemun Night Market  Everland Theme Park  Gyeongju The Beomeosa Templ Busan Jeju Island  Shopping at Olive Young  Shopping at ART Box for kids    Seodaemun Prison History Museum  Street Market shopping