Could you please clarify which statement your example is meant to
confirm or refute?



On 5/20/19, Michael Jones <michael.jo...@gmail.com> wrote:
> ahem...
> https://play.golang.org/p/7gcb9Yv7c9e
>
> On Mon, May 20, 2019 at 2:45 AM <fge...@gmail.com> wrote:
>
>> https://golang.org/ref/spec#Constants
>>
>> "A constant may be given a type explicitly by a constant declaration
>> or conversion, or implicitly when used in a variable declaration or an
>> assignment or as an operand in an expression. It is an error if the
>> constant value cannot be represented as a value of the respective
>> type."
>>
>>
>>
>> On 5/20/19, djad...@gmail.com <djad...@gmail.com> wrote:
>> > Hi,
>> > does this should work ?
>> >
>> > package main
>> >
>> > import (
>> >     "fmt"
>> > )
>> >
>> > func main() {
>> >     const (
>> >         c = 2
>> >         z = 3.3
>> >         y = c * z
>> >         x = int(y) // or x int = y
>> >     )
>> >
>> >     fmt.Println(x)
>> > }
>> >
>> >
>> > it does not compile with error:
>> > constant 6.6 truncated to integer
>> >
>> > https://play.golang.org/p/f-Q6XSvvcrM
>> >
>> > --
>> > 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.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/golang-nuts/736e8b03-d38f-4ec4-adc8-fcb77e0cda7b%40googlegroups.com
>> .
>> > For more options, visit https://groups.google.com/d/optout.
>> >
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/CA%2Bctqrp24YWs4cQVE2NxTEqzn0VxgRLTH3aAbXhjPKV21pDeqA%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
>
> *Michael T. jonesmichael.jo...@gmail.com <michael.jo...@gmail.com>*
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CA%2BctqrqNzTKaAiHpmSpyTZTA0m%3DZCEKRK_EjvO0efJoHBupgSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to