You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let hello = "Здравствуйте";let answer = &hello[0];
The original example has no double quotes. However, the double quotes appear in the text like what I copied. is that on purpose for any reason? Or, is that just a typo?
The text was updated successfully, but these errors were encountered:
It may be misleading that the string within the sentence is ”hello”. I don’t think there’s any connection between this sentence and the code sample above. The point of the sentence is that indices on string slices are not allowed.
The string could be changed to: ”…if &”abc”[0] were valid code […]”.
carols10cents
changed the title
are double quotes added on purpose?
Coincidental correspondence between variable name and string literal is confusing
Jan 8, 2024
...if &"hello"[0] were valid code that returned the byte value, it would return 104, not h.
In chapter 8, section 8.2 shows an example of the indexing of a string as follows.
The original example has no double quotes. However, the double quotes appear in the text like what I copied. is that on purpose for any reason? Or, is that just a typo?
The text was updated successfully, but these errors were encountered: