[Note: parts of this message were removed to make it a legal post.]
Arrays have order because each one represents a sequence of objects. This
guarantees that for a given array you'll get consistent results using the
"each" method:
a = [1,2,3]
a.each {|n| puts n} #you'll always get 1 2 and 3 in that order
Hashes, on the other hand, are more about letting you map some object, the
key, to another object, the value. A single hash can have several of these
mappings, but the "order" of the mappings is insignificant and therefore not
necessarily consistent.
{:a => 1, :b => 2, :c => 3} == {:b => 2, :a => 1, :c => 3} # true
Although all of the the "each" methods provided by a hash ("each",
"each_pair", etc.) return items in a sequence, that sequence isn't
guaranteed to be the same every time.
Hope that helps.
-Jake
On Mon, Jul 12, 2010 at 8:22 AM, Abder-rahman Ali <