Containers is a term used to define arrays or tables for they are used to store variables which are then indexed to be able to retrieve data from them. Hashes on the other hand can be described as dictionaries or associative arrays which are also indexed along with all object references. Arrays are indexed using integers but hashes can be index with any type of object such as a string, expression or the many other types of data they store. When you ask for the contents of a hash, you actually get the index/pointer and the content of the table corresponding to the said value that is stored within that certain value. You can then get the value by indexing the hash with that same key allowing easier/faster searches. Hashes are easier to use in certain instances for you can use any object as the index, on the disadvantage side though, since hashes are not ordered you might find it hard to easily hash a large stack or queue.
Containers and Hashes
This entry was posted in Development, Programming Basics and tagged Functions, Programming. Bookmark the permalink. Comments are closed, but you can leave a trackback: Trackback URL.
