Text says: "Unlike in C, in Go assignment between items of different type
requires an explicit conversion. Try removing the float64 or int conversions in
the example and see what happens."
But the example says:
var x, y int = 3, 4
var f float64 = math.Sqrt(float64(3*3 + 4*4))
so removing the float64 conversion:
var x, y int = 3, 4
var f float64 = math.Sqrt(3*3 + 4*4)
still gives a working program. It might make more sense if the example were:
var x, y int = 3, 4
var f float64 = math.Sqrt(float64(x*x + y*y))
so that the float64 conversion was actually required to make the program work.
Original issue reported on code.google.com by sjnickerson@google.com on 14 May 2014 at 12:45
Original issue reported on code.google.com by
sjnickerson@google.com
on 14 May 2014 at 12:45