what’s rune in Go?

tags: learning go programming tbc

content

TBC what’s the result of fmt.Printf("%T %v\n", 'x', 'x')?

s := "this is a test"
 
for i, r := range s {
	fmt.Printf("index %d:\n", i)
	fmt.Printf("rune is %r\n", r)  // some integer
	fmt.Printf("its underlying int32 is %d\n" r)  // some integer
	fmt.Printf("the char its representing is %c\n", r)  // the char
}

up

down

reference