I need to iterate over a dictionary.

I asked the AI buddy for a little help, and he says:

| myDictionary |

"Create a dictionary"
myDictionary := Dictionary new.
myDictionary at: 'one' put: 1.
myDictionary at: 'two' put: 2.
myDictionary at: 'three' put: 3.

"Iterate over the dictionary"
myDictionary do: [ :key :value |
    Transcript show: key , ' -> ', value printString ; nl.
].

but when i try this, I get:

ArgumentsCountMismatch: This block accepts 2 arguments, but was called with 1 
argument.

Is the AI using a different dialect of smalltalk?

how would I go about acting on each pair?

Thanks!

----
peace,
sergio
photographer, journalist, visionary

Public Key: 
https://pgp.key-server.io/pks/lookup?op=get&search=0x69B08F58923AB3A2
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101

Reply via email to