If the data type of channels looks like “chan Type” then what are the differences between
c := make(chan string)
And
var c chan string
Which one should I use and why?
If the data type of channels looks like “chan Type” then what are the differences between
c := make(chan string)
And
var c chan string
Which one should I use and why?
Using := declares and initialize the variable.
If you use var, you need to initialize the var using make. For example
var c chan string
c = make(chan string)`
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.