To convert a rune to an int, you can use the “int()” function.
Example
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 Software Engineer with over eight years of experience. He has developed a strong foundation in computer science principles and a passion for problem-solving. In addition, Krunal has excellent knowledge of Distributed and cloud computing and is an expert in Go Language.