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
+4.8k List of Golang XML tutorials
+11.4k Elastic Search : Return all records (higher than default 10)
+5.9k Golang : Normalize email to prevent multiple signups example
+17.1k Golang : Implement getters and setters
+10.5k How to tell if a binary(executable) file or web application is built with Golang?
+4.9k Golang : Measure execution time for a function
+11k Golang : Send data to /dev/null a.k.a blackhole with ioutil.Discard
+5.2k Javascript : Generate random key with specific length
+42.6k Golang : Use wildcard patterns with filepath.Glob() example
+12.8k Golang: Pad right or print ending(suffix) zero or spaces in fmt.Printf example