On Sun, Dec 16, 2018 at 6:15 PM 伊藤和也 <kazya.ito.dr...@gmail.com> 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 untyped constant has a default > type which is the type to which the constant is implicitly converted in > contexts where a typed value is required."
The default type is only used for an untyped constant when a type is required but there is no other type. In your example there is another type: int32. The untyped constant "12" is given the type "int32". Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.