I'm new to Golang. I'm sorry but I'm still confused on what's the difference between:
type <Name> <dataType>
and
type <Name> = <dataType>
Here's an example:
package main
import "fmt"
func main() {
var (
strWord Word
strText Text
)
strWord = "gopher"
strText = "golang"
fmt.Printf("strWord = %s, Type of Value = %T
", strWord, strWord)
fmt.Printf("strText = %s, Type of Value = %T
", strText, strText)
}
type Word string
type Text = string
Output
strWord = gopher, Type of Value = main.Word
strText = golang, Type of Value = string
Then, when should we use between the two?