22件ヒット
[1-22件を表示]
(0.098秒)
ライブラリ
- ビルトイン (22)
検索結果
先頭2件
-
Enumerable
# each _ with _ index(*args) -> Enumerator (14.0) -
要素とそのインデックスをブロックに渡して繰り返します。
...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
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}
@see Enumerator#with... -
Enumerable
# each _ with _ index(*args) {|item , index| . . . } -> self (14.0) -
要素とそのインデックスをブロックに渡して繰り返します。
...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
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}
@see Enumerator#with...