るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.091秒)

別のキーワード

  1. string bytesize
  2. _builtin bytesize
  3. bytesize string
  4. bytesize _builtin

ライブラリ

クラス

検索結果

Enumerator#next -> object (18156.0)

「次」のオブジェクトを返します。

...合は、
StopIteration 例外を発生します。このとき列挙状態は変化しません。
つまりもう一度 next を呼ぶと再び例外が発生します。

next
メソッドによる外部列挙の状態は他のイテレータメソッドによる
内部列挙には影響を与え...
...っている場合には影響があり得ます。

@
raise StopIteration 列挙状態が既に最後へ到達しているとき
@
see Enumerator#rewind

//emlist[例1][ruby]{
str = "xyz"
enum = str.each_byte

str.bytesize.times do
puts enum.next
end
# => 120
# 121
# 122
//}

//em...
...ist[例2][ruby]{
str = "xyz"
enum = str.each_byte

begin
puts enum.next while true
rescue StopIteration
puts "iteration reached at end"
end
# => 120
# 121
# 122
# iteration reached at end
puts enum.next
#=> 再度 StopIteration 例外が発生
//}

//emlist[例3: Ker...