| t1 |
t1 _ 'a string'
I think...
EDIT: Whoops! Instance, not temporary. Sorry!
Last edited by Hardmath123 (2012-03-08 04:59:52)
Offline
If you've declared the instance variable, you can just assign to it. You don't need to "convert" because Smalltalk is dynamically typed. e.g.:
"all fine on the same instance variable"
foo := 3.
foo := OrderedCollection new.
foo := 'Hello!'.
I wouldn't recommend doing this too often, though, because it can make your code confusing if an instance variable means two different things in two scenarios.
Offline
jurk wrote:
no nXIII the other way like from a string to an instance variable
![]()
and not from a instance variable to a string![]()
You can't convert a string to an instance variable, unless you mean adding an instance variable dynamically, which you shouldn't do anyway (just use a Dictionary). You can assign to an instance variable, which is what I just showed you. You can't assign to a string.
Last edited by nXIII (2012-03-09 07:46:09)
Offline
Not sure why we are using the word 'convert' isn't it just changing its output?
blockbin _ hello world.
Or is it making a new instance variable named with the string...
Offline