From "Smalltalk-80":
Because argument names are pseudo-variable names, they can be used to access values, such as variable names, but their values cannot be changed by purpose. In the spend:for: method spend:for: statement of the form
amount =: amount * taxRate
will be syntactically illegal since the value of the sum cannot be reassigned.
You can use the collect: message to create a new collection:
z =: y collect: [:char | (ch asciiValue + 1) asCharacter ].
Character do not respond to + , so you will need to convert to Integer and vice versa. Note that since String are collections, they also respond to collect:
x collect: [:ch | (ch asciiValue + 1) asCharacter ]
If you only need ASCII characters, take the remainder modulo 128 before converting it back to a character.
x collect: [:ch | (ch asciiValue + 1 \\ 128) asCharacter ]
If you want to increase only letters, not other characters, add a conditional value to the block.
x collect: [:ch | ch isLetter ifTrue: [(ch asciiValue + 1) asCharacter] ifFalse: [ch] ]
Note that the last block does not process letters at the end of an adjacent range (for example, $z or, if the interpreter supports advanced ASCII or Unicode, $<16rD6> ), since the exact method depends on the capabilities of the system (basically, what is considered a letter).