-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
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
x/tour: #15 implies conversion is necessary when it isn't #7036
Labels
Milestone
Comments
See http://golang.org/ref/spec#Constant_expressions. The expression 3*3 + 4*4 is untyped, not an int. |
Comment 2 by blair@orcaware.com: Thanks, however, constants are first introduced on slide #16. Being a Go newbie, I find the text confusing and it implies that the float64() is required when it isn't, unlike the `int(f)` which is required. |
package main import ( "fmt" "math" ) func main() { var x, y int = 3, 4 var f float64 = math.Sqrt(float64(x*x + y*y)) var z int = int(f) fmt.Println(x, y, z) } since we have x and y int = 3, 4 it would make sense: var f float64 = math.Sqrt(float64(x*x + y*y)) Now the program and the text would fit. |
Owner changed to @adg. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by blair@orcaware.com:
The text was updated successfully, but these errors were encountered: