Golang : Convert(cast) int to int64
It is not so cool to use type int now. It was so yesterday. Everyone wants to move to 64-bit computing now. This tutorial will show you how to convert / type cast int to int64
package main
import (
"fmt"
)
func main() {
var i int64 = 10
var int64value int64 = int64(i)
fmt.Println(int64value)
// or
fmt.Println(int64(int64value))
}
Output :
10
10
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+3.9k Golang : Experimental emojis or emoticons icons programming language
+9.3k Golang : How to detect a server/machine network interface capabilities?
+4k PHP : How to handle URI or URL with non-ASCII characters such as Chinese/Japanese/Korean(CJK) ?
+27.6k Golang : How to get HTTP request header information?
+3.5k Golang : Constant and variable names in native language
+9.7k Golang : Change date format to yyyy-mm-dd
+10.7k Golang : Human readable time elapsed format such as 5 days ago
+6.6k Golang : Build and compile multiple source files
+4.2k Golang : Selection sort example
+4.5k PHP : How to check if an array is empty ?
+9.8k Golang : How to check if your program is running in a terminal
+15k Golang : Linked list example