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
+9.1k Golang : Get all countries currencies code in JSON format
+19.4k Golang : Append content to a file
+19.3k Golang : Measure http.Get() execution time
+8.4k Golang : Find duplicate files with filepath.Walk
+18.8k Golang : Check if directory exist and create if does not exist
+4.7k Golang : Constant and variable names in native language
+5.7k Fix ERROR 2003 (HY000): Can't connect to MySQL server on 'IP address' (111)
+8.6k Golang : Go as a script or running go with shebang/hashbang style
+20.6k Golang : For loop continue,break and range
+12.1k Golang : Add ASCII art to command line application launching process
+10.9k Golang : Fix fmt.Scanf() on Windows will scan input twice problem
+5.2k Clean up Visual Studio For Mac installation failed disk full problem