On Thu, Aug 13, 2020 at 3:02 PM Sathish VJ <sathis...@gmail.com> wrote:

> Why is this not allowed?
>
>         s := "hello"
> s[0] = 'a' // compile error: cannot assign to s[0]
>
> https://play.golang.org/p/zyJXwhEeKPo

""""
Strings are immutable: once created, it is impossible to change the
contents of a string.
""""

(https://golang.org/ref/spec#String_types)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-X8oy_MQF%2BKmvuda_0UkLsVGGgnt89NbUpxjA_iboyC0Q%40mail.gmail.com.

Reply via email to