How to create a dictionary in Snap

is there a way to create a dict
i don't want to make a 2-dimensional list

With JS it's easy. In pure Snap!, though, you need to use a 2D list to make it make much sense. And, @bh would likely suggest doing the latter.

As WWW says 2D lists are the background building block for dictionaries in Snap!

What is it that makes you want to not use them?

BTW I'm using them a lot in my current project and they work great

Maybe they don't want O(n) time complexity for lookups?

Then build a hash table, O(1) and easy to build out of Snap! lists. (Presumably that's how JS dicts are implemented.) I think that was the first-ever project on the original BYOB thread of the Scratch forum, having just revisited that lately. Or build one of many kinds of balanced binary trees, O(log N) time.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.