Convert Int data type to Int16 Int32 Int64
Example
package main
import (
"fmt"
"reflect"
)
func main() {
var i int = 10
fmt.Println(reflect.TypeOf(i))
i16 := int16(i)
fmt.Println(reflect.TypeOf(i16))
i32 := int32(i)
fmt.Println(reflect.TypeOf(i32))
i64 := int64(i)
fmt.Println(reflect.TypeOf(i64))
}
Output
int
int16
int32
int64
Most Helpful This Week
Generate a Keygen of 256 bits
How to use wildcard or a variable in our URL for complex routing?
Runtime package variables
The return values of a function can be named in Golang
How to check if a string contains certain characters in Golang?
Creating a Function in Golang
How to Draw a rectangle in Golang?
Get Year, Month, Day, Hour, Min and Second from current date and time.
Golang Read Write Create and Delete text file
How to read current directory using Readdir?