We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I define a function named sqrt in Golang:
sqrt
package main import ( "fmt" "math" ) func main() { func sqrt(x float64) string { if x < 0 { return sqrt(-x) + "i" } else { return fmt.Sprint(math.Sqrt(x)) } } sqrt(20); }
then compile it, go compiler: mymath.go:9:7: syntax error: unexpected sqrt, expected (
mymath.go:9:7: syntax error: unexpected sqrt, expected (
When I change this function to a lambda:
package main import ( "fmt" "math" ) func main() { var sqrt = func(x float64) string { if x < 0 { return sqrt(-x) + "i" } else { return fmt.Sprint(math.Sqrt(x)) } } sqrt(20) }
then compile it, go compiler: mymath.go:11:11: undefined: sqrt'
mymath.go:11:11: undefined: sqrt
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When I define a function named
sqrt
in Golang:then compile it, go compiler:
mymath.go:9:7: syntax error: unexpected sqrt, expected (
When I change this function to a lambda:
then compile it, go compiler:
mymath.go:11:11: undefined: sqrt
'The text was updated successfully, but these errors were encountered: