User's guide string modification

Previous Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

User's guide string modification

Clif Brown
I am learning Smalltalk, going through the Object Studio Smalltalk User's Guide. All has been going well, but on page 123 I've hit a snag in attempting to modify the area code segment of a local variable, phoneNumber.

The code I'm using is:

setAreaCode: aString
"Public - set local number to aString"
    phoneNumber replaceFrom:2 to:4 with: aString.

when run, I get the exception - Core.NoModificationError

I know that literals are immutable, but since I am working with a variable, that should not be an issue.