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
+23.6k Golang : Use regular expression to validate domain name
+8.8k Golang : io.Reader causing panic: runtime error: invalid memory address or nil pointer dereference
+28.9k Golang : missing Git command
+7.1k Golang : File system scanning
+9.9k Golang : Text file editor (accept input from screen and save to file)
+5.2k Golang : If else example and common mistake
+18.7k Golang : When to use public and private identifier(variable) and how to make the identifier public or private?
+22.4k Golang : Strings to lowercase and uppercase example
+11.8k Golang : Get remaining text such as id or filename after last segment in URL path
+5.9k Linux/Unix : Commands that you need to be careful about
+7.7k Golang : Grayscale Image
+18.3k Golang : Generate thumbnails from images