Dear gophers,

I'd appreciate some help.

Given:

func main() {
r := 'a'
s := "a"
fmt.Println(r)
fmt.Println(s)
}

My very possibly incorrect understanding is that the rune r holds a Unicode 
code-point encoded with UTF-8 and stored as integer value, in this case 97, 
as type int32.   s is of type string, and contains a code-point encoded by 
UTF-8, but which will be stored in a slice of type byte (which will use 
just one uint8 in this case).  Assuming that is all correct, then my 
questions are:

1. Will the rune / any rune always use 32 bits?
2. Why does printing r output the integer value, but printing s yield the 
code-point itself?

Cheers for your help.
JC.


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to