Clear Dictionary

cybernetsurfer7
10 May 2014, 20:55Hello!
I just have what I hope is a quick question. Is it possible to clear all values from a Dictionary? I have a situation where I'm not totally sure what values will be in the dictionary but I need to clear them out so past values don't interfere with new ones. Is there a way to use Dictionary Remove? Thanks so much!
Cheers!
Caleb
---------------------------------------------------------------------------------------------
Current Project: Under Shadows v0.1
To play most updated version go to: http://veepry.com/undershadows.html
To see version history, features, bugs, and future updates go to: http://veepry.wordpress.com/category/under-shadows/
For comments use the above blog or contact me at: http://veepry.com/contact.html
---------------------------------------------------------------------------------------------
I just have what I hope is a quick question. Is it possible to clear all values from a Dictionary? I have a situation where I'm not totally sure what values will be in the dictionary but I need to clear them out so past values don't interfere with new ones. Is there a way to use Dictionary Remove? Thanks so much!
Cheers!
Caleb
---------------------------------------------------------------------------------------------
Current Project: Under Shadows v0.1
To play most updated version go to: http://veepry.com/undershadows.html
To see version history, features, bugs, and future updates go to: http://veepry.wordpress.com/category/under-shadows/
For comments use the above blog or contact me at: http://veepry.com/contact.html
---------------------------------------------------------------------------------------------

jaynabonne
11 May 2014, 07:31In my experience, the easiest way to have an empty dictionary is just to create a new one to replace the one you've been using. It might help if you could expand a bit on the case you want, but usually just assigning NewDictionary() to whatever variable or attribute you have will do it.

jaynabonne
11 May 2014, 12:55If you do need to empty a dictionary, here's one way to do it:
You can't modify the dictionary while enumerating it. So you have to shove the keys somewhere else first.
<function name="EmptyDictionary" parameters="dict">
keys = NewList()
foreach (key, dict) {
list add (keys, key)
}
foreach (key, keys) {
dictionary remove (dict, key)
}
</function>
You can't modify the dictionary while enumerating it. So you have to shove the keys somewhere else first.

cybernetsurfer7
12 May 2014, 15:35Thanks Jay! Using NewDictionary() worked perfectly.
---------------------------------------------------------------------------------------------
Current Project: Under Shadows v0.1
To play most updated version go to: http://veepry.com/undershadows.html
To see version history, features, bugs, and future updates go to: http://veepry.wordpress.com/category/under-shadows/
For comments use the above blog or contact me at: http://veepry.com/contact.html
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
Current Project: Under Shadows v0.1
To play most updated version go to: http://veepry.com/undershadows.html
To see version history, features, bugs, and future updates go to: http://veepry.wordpress.com/category/under-shadows/
For comments use the above blog or contact me at: http://veepry.com/contact.html
---------------------------------------------------------------------------------------------