Post

GoLangGoLang

christina joce

Posted on 27th April 2024|15 views

0
votes

Golang Create Empty Slice

How can I create an empty slice in Golang?

Answers
P
ravi sankar

Posted on 27th April 2024

package main

Import ("fmt"

"reflect")

func main()

{

 var intEmptySlice []int

 var strEmptySlice []string

fmt.Println(reflect.ValueOf(intEmptySlice).Kind())

fmt.Println(reflect.ValueOf(strEmptySlice).Kind())

}

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos