On Thu, Feb 7, 2019 at 11:25 AM Jamie Caldwell <mr.jamie.caldw...@gmail.com>
wrote:

> But why would you use one over the other? Why does Go support being able
to assign a codepoint using single quotes?

`type rune` vs type `string` not the same, but is bit like `type byte` vs
`type []byte`. The serve very different purposes. One cannot do the same
things with `byte` that can be done with `[]byte`.

> Also, why do they take more than three bytes each?

`rune` is an alias of `int32`, hence 4 bytes.

`string` is a two word struct, hence 2*size of pointer. 8 or 16 bytes.

-- 

-j

-- 
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