each_pair()
public
Calls block once for each key in
hsh, passing the key and value as parameters.
h = { "a" => 100, "b" => 200 }
h.each_pair {|key, value| puts "#{key} is #{value}" }
produces:
a is 100
b is 200
Show source
/*
* call-seq:
* hsh.each_pair {| key_value_array | block } -> hsh
*
* Calls <i>block</i> once for each key in <i>hsh</i>, passing the key
* and value as parameters.
*
* h = { "a" => 100, "b" => 200 }
* h.each_pair {|key, value| puts "#{key} is #{value}" }
*
* <em>produces:</em>
*
* a is 100
* b is 200
*
*/
static VALUE
rb_hash_each_pair(hash)
VALUE hash;
{
rb_hash_foreach(hash, each_pair_i, 0);
return hash;
}