24件ヒット
[1-24件を表示]
(0.030秒)
別のキーワード
ライブラリ
- ビルトイン (24)
検索結果
先頭2件
-
Enumerable
# each _ with _ index(*args) -> Enumerator (25.0) -
要素とそのインデックスをブロックに渡して繰り返します。
...(each など) にそのまま渡されます。
//emlist[例][ruby]{
[5, 10, 15].each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}
//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end... -
Enumerable
# each _ with _ index(*args) {|item , index| . . . } -> self (25.0) -
要素とそのインデックスをブロックに渡して繰り返します。
...(each など) にそのまま渡されます。
//emlist[例][ruby]{
[5, 10, 15].each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}
//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end...