How to change int into int64?

Go

Go Problem Overview


Im trying to convert an integer into an integer64 in go but im having no luck. Anyone know an easy way to do this?

Go Solutions


Solution 1 - Go

This is called type conversion :

i := 23
var i64 int64
i64 = int64(i)

Solution 2 - Go

This is probably obvious, but simplest:

i64 := int64(23)

Solution 3 - Go

i := 23
i64 := int64(i)
fmt.Printf("%T %T", i, i64) // to print the data types of i and i64

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAC3112View Question on Stackoverflow
Solution 1 - GoDenys SéguretView Answer on Stackoverflow
Solution 2 - GoRyan WallsView Answer on Stackoverflow
Solution 3 - GoAnupam GhoshView Answer on Stackoverflow