Topic was automatically imported from the old Question2Answer platform.
Asked By
rogerdv
Can somebody explain me how does the dictionary type works? My recent experiences are with Unity/C# dictionaries, and I would like to know the differences with GDScript dictionaries, because I have the impression that they are more like structs and not a key,value pair.
What caused your impression? The documentation for dictionary starts by stating: “Associative container which contains values referenced by unique keys”. It also includes gdscript-examples for everything (I would consider) important.
Because I couldnt find any example about how to iterate it. Also, a C#/C++ dictionary uses keys of a single type, like string, value_type. I see that GDScript can have keys of different types.
rogerdv | 2020-02-03 15:13
You can iterate through a dictionary’s keys or values by pulling them as an array, then running a for loop on them. For example: