6 ms·
I really like the structure of this, very readable and a great intro. I have some confusion on http://www.golang-book.com/6 http://www.golang-book.com/6 It sa
by Gazler 14y ago
I really like the structure of this, very readable and a great intro. I have some confusion on http://www.golang-book.com/6 http://www.golang-book.com/6
It says:
Go also provides a shorter syntax for creating arrays:
x := [5]float64{ 98, 93, 77, 82, 83 }
We no longer need to specify the type because Go can figure it out. Sometimes arrays like this can get too long to fit on one line, so Go allows you to break it up like this:
However the type is specified as `float64`
- zemo 14y agohe means the type of the individual elements. Each element is of type float64, not int.
- nyan_sandwich 14y agovs Java-like float64 myfloat64array[] = new(float64[5], ...)
- cdoxsey 14y agoI meant you didn't need this: var x [5]float64 = [5]float64{ 98, 93, 77, 82, 83 } But I explained ":=" earlier so I can see how that would be confusing.