diff --git a/doc/docs.md b/doc/docs.md index 96dfbb0d45..4235625b2d 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -355,7 +355,14 @@ println(s) // "hello world" In V, a string is a read-only array of bytes. String data is encoded using UTF-8. -Strings are immutable. +Just like in Go and Java, strings are immutable, which means their values cannot be changed. + +The following code will raise an error: + +```v +mut s := 'hello' +s[0] = `H` +``` Both single and double quotes can be used to denote strings. For consistency, `vfmt` converts double quotes to single quotes unless the string contains a single quote character.