From: "SHULTZ,BARRY (HP-Israel,ex1)" Date: 2001-02-25T16:15:56+09:00 Subject: [ruby-talk:11512] RE: ANN: ri - the Ruby Interactive reference Hi Dave, I'm getting this after installing on NT: C:\ruby\bin>ruby ri.rb each_with_index ri.rb:163: warning: Old marshal file format (can be read) Don't know anything about a method called `each_with_index'. Help :0) ? Barry > > % ri each_with_index > > and you'll see: > > ------------------------------------------------------------------ > enumObj.each_with_index {| obj, i | block } -> nil > ------------------------------------------------------------------ > Calls block with two arguments, the item and its index, for each > item in enumObj. > > hash = Hash.new > %w(cat dog wombat).each_with_index {|item, index| > hash[item] = index > } > hash #=> {"dog"=>1, "wombat"=>2, "cat"=>0} > >