Re: [go-nuts] make an empty slice

2019-06-06 Thread Marvin Renich
* sasikala tholisam  [190606 09:49]:
> 
> test []Exam
> 
> type Exam struct{
> Time uint32
> LogType uint32
> Data [32]byte
> }
> 
> test is a slice of []Exam..It should be an empty slice...how to make test 
> as empty?

After changing the first line to

var test []Exam

your code will produce an empty slice for test.  You can check its
length with len(test) and it will be 0.  Here's the code on the
playground:  https://play.golang.org/p/UtZ-YhNXojk

...Marvin

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/20190606145528.ufocsb6tfi5i6pah%40basil.wdw.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] make an empty slice

2019-06-06 Thread Mark Bauermeister
You mean a slice that is not of type Exam?

test []int

Should work.
Your slice does need to adhere to some type.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/fba31d31-7797-45b0-9473-1b1ba88ad937%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] make an empty slice

2019-06-06 Thread sasikala tholisam


test []Exam

type Exam struct{

Time uint32

LogType uint32

Data [32]byte

}

test is a slice of []Exam..It should be an empty slice...how to make test 
as empty?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9354700e-0441-4626-a65e-13eb31171a3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.