Hi,

you can simply do:

dict := Dictionary new.
dict at: #key1 put: 'value1'.
dict at: #key2 put: 'value2'.

In your case the problem is the assoc variable (you just change the content) here is the solution:

dict := Dictionary new.
assoc := Association key: #key1 value: 'value1'. " or #key1->'value1' "
dict add: assoc.
assoc := Association key: #key2 value: 'value2'. " or #key2->'value2' "
dict add: assoc.

Gwen

On 04/06/2011 02:43 PM, Wolfgang Dann wrote:
Hi,

I don't understand what's wrong with this one:

st>  dict := Dictionary new
Dictionary (
)
st>  assoc := Association key: #key1 value: 'value1'
#key1->'value1'
st>  dict add: assoc
#key1->'value1'
st>  dict
Dictionary (
        #key1->'value1'
)
st>  assoc key: #key2 value: 'value2'
#key2->'value2'
st>  dict
Dictionary (
        #key2->'value2'
)
st>  dict add: assoc
#key2->'value2'
st>  dict
Dictionary (
        #key2->'value2'
        #key2->'value2'
)

best regards



_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk


_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to