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
+17.4k Golang : How to tell if a file is compressed either gzip or zip ?
+10.7k Golang : Flip coin example
+12.8k Golang : flag provided but not defined error
+13.7k Golang : Get user input until a command or receive a word to stop
+7.2k Javascript : How to get JSON data from another website with JQuery or Ajax ?
+6k Facebook : How to force facebook to scrape latest URL link data?
+34.1k Golang : Proper way to set function argument default value
+6.3k PHP : How to handle URI or URL with non-ASCII characters such as Chinese/Japanese/Korean(CJK) ?
+6.7k Golang : Warp text string by number of characters or runes example
+7.4k Golang : How to fix html/template : "somefile" is undefined error?
+9.2k Golang : Serving HTTP and Websocket from different ports in a program example
+10.5k Generate Random number with math/rand in Go