Answers for "golang interface to int64"

Go
0

int to int64 golang

var i int = 32
j := int64(i)
Posted by: Guest on April-08-2021
-1

golang interface to int

var myInt interface{}
myInt = 8

toInt, ok := myInt.(int)
fmt.Println(toInt, ok)  // 8 true

toString, ok := myInt.(string)
fmt.Println(toString, ok)  // "" false
Posted by: Guest on May-17-2021

Browse Popular Code Answers by Language