るりまサーチ

最速Rubyリファレンスマニュアル検索!
44件ヒット [1-44件を表示] (0.042秒)
トップページ > クエリ:nil[x] > クエリ:at[x] > クエリ:cycle[x]

別のキーワード

  1. _builtin nil?
  2. nilclass nil?
  3. object nil?
  4. object nil
  5. _builtin nil

ライブラリ

クラス

モジュール

検索結果

Enumerable#cycle(n=nil) -> Enumerator (18345.0)

Enumerable オブジェクトの各要素を n 回 or 無限回(n=nil)繰り返し ブロックを呼びだします。

...各要素を n 回 or 無限回(n=nil)繰り返し
ブロックを呼びだします。

n に 0 もしくは負の値を渡した場合は何もしません。
繰り返しが最後まで終了した場合(つまりbreakなどで中断しなかった場合)
nil を返します。
このメソ...
.../emlist[例][ruby]{
a = ["a", "b", "c"]
a.cycle {|x| puts x } # print, a, b, c, a, b, c,.. forever.
a.cycle(2) {|x| puts x } # print, a, b, c, a, b, c.
//}

ブロックを省略した場合は、n 回 or 無限回 enum の各要素を
繰り返す Enumerator を返します。

@return ブロッ...
...クを指定しなかった場合は、Enumerator を返します。
レシーバが空の場合は nil を返します。...

Array#cycle(n=nil) -> Enumerator (18327.0)

配列の全要素を n 回(nilの場合は無限に)繰り返しブロックを呼びだします。

...配列の全要素を n 回(nilの場合は無限に)繰り返しブロックを呼びだします。

ブロックを省略した場合は Enumerator を返します。

@param n 繰り返したい回数を整数で指定します。
整数以外のオブジェクトを指定した場合...
...黙の型変換を試みます。

@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。

//emlist[例][ruby]{
a = ["a", "b", "c"]
a.cycle {|x| puts x } # print, a, b, c, a, b, c,.. forever.
//}...

Enumerator::Lazy#zip(*lists) -> Enumerator::Lazy (3119.0)

Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。

...merator::Lazy を返します。

ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。

//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator...
...: "a".."z":cycle>)>

1.step.lazy.zip(('a'..'z').cycle).take(30).force.last(6)
# => [[25, "y"], [26, "z"], [27, "a"], [28, "b"], [29, "c"], [30, "d"]]
//}

@see Enumerable#zip...

Enumerator::Lazy#zip(*lists) {|v1, v2, ...| ... } -> nil (3119.0)

Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。

...merator::Lazy を返します。

ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。

//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator...
...: "a".."z":cycle>)>

1.step.lazy.zip(('a'..'z').cycle).take(30).force.last(6)
# => [[25, "y"], [26, "z"], [27, "a"], [28, "b"], [29, "c"], [30, "d"]]
//}

@see Enumerable#zip...