Overwriting built-in functions
package main
import "fmt"
func main() {
len := len("abc")
fmt.Println(len)
// x := len("def") // cannot call non-function len (type int)
}
- TODO: Why does Go allow for this without any complaint?
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
package main
import "fmt"
func main() {
len := len("abc")
fmt.Println(len)
// x := len("def") // cannot call non-function len (type int)
}