Mar 19, 2021

[Go] untype type

Reference:
https://groups.google.com/g/golang-nuts/c/9EVmGFVoawg/m/nYXYaUcpCgAJ


Untyped bool, int, etc are the types of untyped constants:
https://golang.org/ref/spec#Constants

package main

const i = 42      // i is untyped int
const j = int(42) // j is int

var f float64 = i // ok because i is untyped int
var g float64 = j // compile error, type mismatch

func main() {
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.