How to loop through a dictionary?
Let’s loop through a item dictionary. This is useful for a loop vs a simple list or an array because sometimes, the count can be huge. 10 is not large. To cycle through 60,000 or 6,000,000 can be time consuming. Let’s see if we can use dictionaries to find the item based on the key id. To start, let’s create a dictionary item DB.
All of these items have been added via script into our database. Now we can sort through this list using library keys.
Let’s do a foreach loop.
If we want to simply search the key in the loop, we can run a foreach.
If we want to find the value, we can search that as well
To grab an item from this list, use the following: