While I was reading "the little go" book, I found that it suggests to write a function without any return value. So I proceed to test that function but the program won't compile and give me this "... used as value"error. Anyone knows what is going on here?
package main
import (
"fmt"
)
func log(message string) {
fmt.Println(message)
}
func main() {
msg := log("just a message")
fmt.Println(msg)
}
I know that this function is trivial (maybe the question is stupid also). But I am just curious to know if this type of function legal in Go?