logo-MindMajix
PostGoLangGoLang
christina joce

Posted on 13th June 2024|16 views

0
votes

Golang Create Empty Slice

How can I create an empty slice in Golang?

1 answers
Answers
P
ravi sankar

Posted on 13th June 2024| views

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
Name
Course *
Email *
Phone Number