To convert a rune to an int in Go, you can use the “int()” function.
package main
import "fmt"
func main() {
r := 'B'
intValue := int(r)
fmt.Println("Rune as int:", intValue)
}
Output
Rune as int: 66
In this code example, a rune “r” represents the Unicode code point for the letter “B”.
You can see that we used the “int(r)” function to perform the type conversion, and the result is printed to the console.

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.