Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
Swift
/
Swift fundamentals
Why does Swift not accept text[0] for a String?
from Swift fundamentals
Swift 6.3.3
beginner
1 min
Why does Swift not accept text[0] for a String?
A Character can span multiple Unicode scalars or bytes, so valid positions use String.Index rather than arbitrary integers.
String values are reference types and cannot be subscripted.
Swift strings are always stored in reverse order.
Check
Ask AI about this kata
Report an error
previous kata
Which statement about var retryCount = 0 is correct?
Quiz
next kata
What does this program print?
Predict the output
A new version is available
Reload