Il giorno giovedì 8 settembre 2016 17:31:55 UTC+2, Uvelichitel ha scritto:
>
>     package main 
>
>      import "fmt" 
>
>      func main() { 
>          const x, y = 5, 3 
>          var f float32 = x / y 
>          fmt.Println(f) 
>      } 
>
> output 
> 1 
> https://play.golang.org/p/FH1f793gWI 
> How this doesn't produce 1.66666 
> Would be thankful for explanation. 
>

https://golang.org/ref/spec#Constants
"... An untyped constant has a default type which is ..."

In your case the default type of x and y are integer constants.


Manlio

 

-- 
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.

Reply via email to