I have an issue and this is the result when i call one method in my code.
t do:[:i |
dict := Dictionary newFrom:{t->items}.
].
t is an
OrderedCollection(#name #lastName #birthDate)
and items too. items an OrderedCollection('cs0yh1n1b2bm0wps16uvy7tfi' 'cs0yh1k1t3bgdszfupe407qdg' 21 April 1975)
a Dictionary [1 item] (an OrderedCollection(#name #lastName #birthDate)->an OrderedCollection('cs0yh1n1b2bm0wps16uvy7tfi' 'cs0yh1k1t3bgdszfupe407qdg' 21 April 1975).
I would like to obtain a gender dictionary
a Dictionary (#name->'cs0yh1n1b2bm0wps16uvy7tfi' #lastNamename->'cs0yh1k1t3bgdszfupe407qdg' #birthDay->21 April 1975)
how can i do this please ?
You are creating a new Dictionary each time through the loop. You need to create a new (empty) Dictionary before the loop and add each element using
#'at:put:'. If you want to map index 1 intto index 1 initems, then you need to have a counter. Perhaps1 to: t size do: [:i | ...].You are asking a lot of questions about Smalltalk and we are delighted to have you learning it. Have you tried spending a few hours studying a book or taking a course? I recommend the Pharo Mooc, some Pharo books, or some Smalltalk books.