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
+8.5k Golang : Convert word to its plural form example
+12.4k Golang : Validate email address
+29.6k Golang : How to create new XML file ?
+12.1k Golang : Setup API server or gateway with Caddy and http.ListenAndServe() function example
+46.6k Golang : Encode image to base64 example
+12.9k Golang : Listen and Serve on sub domain example
+51.5k Golang : Check if item is in slice/array
+31k Golang : Interpolating or substituting variables in string examples
+31.3k Golang : Calculate percentage change of two values
+8.9k Golang : Random integer with rand.Seed() within a given range
+4.7k JavaScript : Rounding number to decimal formats to display currency