On Sun, Dec 16, 2018 at 6:15 PM 伊藤和也 wrote:
>
> Can I say the type of the integer constant "12" is converted from the default
> type "int" to "int32" when it is assigned to the constant "n1" whose type is
> "int32" ?
>
> const n1 int32 = 12
>
> Go programmimg language specification says "An unt
Can I say the type of the integer constant "12" is converted from the
default type "int" to "int32" when it is assigned to the constant "n1"
whose type is "int32" ?
const n1 int32 = 12
Go programmimg language specification says "An untyped constant has a *default
type* which is the type to wh
https://blog.golang.org/constants
This explains why you can do stuff like that and why the Go team decided to
make the language work this way.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emai
Hello golang-nuts,
Here are two code snippets with operations on different types. One with
constants and another one with variables. The first one works, the second
one doesn't. Why is it like this? Logically both code snippets shouldn't
work:
https://play.golang.org/p/eqNJootZ3a
package main