るりまサーチ

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

別のキーワード

  1. prime next
  2. _builtin next
  3. date next
  4. date next_month
  5. date next_year

ライブラリ

クラス

モジュール

キーワード

検索結果

Enumerator#next -> object (18149.0)

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

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

next
メソッドによる外部列挙の状態は他のイテレータメソッドによる
内部列挙には影響を与え...
...enum.next
end
# => 120
# 121
# 122
//}

//emlist[例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: Kernel.#loop は StopIteration を捕捉します。][ruby]{
str = "xyz"
enum = str.each_byte
loop
do
puts enum.next
end
# => 120
# 121
# 122
//}...

Kernel.#loop -> Enumerator (18120.0)

(中断されない限り)永遠にブロックの評価を繰り返します。 ブロックが指定されなければ、代わりに Enumerator を返します。

...ックの評価を繰り返します。
ブロックが指定されなければ、代わりに Enumerator を返します。

//emlist[例][ruby]{
loop
do
print "Input: "
line = gets
break if !line or line =~ /^qQ/
# ...
end
//}

与えられたブロック内で StopIteration を Kernel.#ra...
...
ループを終了させる場合、通常は break を使用してください。

//emlist[例][ruby]{
enum = Enumerator.new { |y|
y << "one"
y << "two"
:ok
}

result = loop {
puts enum.next
} # => :ok
//}


@return break の引数など、ループ脱出時の値を返します。...

Kernel.#loop { ... } -> object | nil (18120.0)

(中断されない限り)永遠にブロックの評価を繰り返します。 ブロックが指定されなければ、代わりに Enumerator を返します。

...ックの評価を繰り返します。
ブロックが指定されなければ、代わりに Enumerator を返します。

//emlist[例][ruby]{
loop
do
print "Input: "
line = gets
break if !line or line =~ /^qQ/
# ...
end
//}

与えられたブロック内で StopIteration を Kernel.#ra...
...
ループを終了させる場合、通常は break を使用してください。

//emlist[例][ruby]{
enum = Enumerator.new { |y|
y << "one"
y << "two"
:ok
}

result = loop {
puts enum.next
} # => :ok
//}


@return break の引数など、ループ脱出時の値を返します。...

制御構造 (82.0)

制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END

...制御構造
条件分岐:
* if
* unless
* case
繰り返し:
* while
* until
* for
* break
* next
* redo
* retry
例外処理:
* raise
* begin
その他:
* return
* BEGIN
* END

Rubyでは(Cなどとは異なり)制御構造は式であ...
...プの戻り値はその引数になります。


====[a:next] next

//emlist[例][ruby]{
# 空行を捨てるcat
ARGF.each_line do |line|
next
if line.strip.empty?
print line
end
//}

文法:

next


next
val


next
はもっとも内側のループの次の繰り返しにジ...
...unexpected keyword_BEGIN

class Foo
BEGIN { p "begin" }
end
# => -e:2: syntax error, unexpected keyword_BEGIN

loop
do
BEGIN { p "begin" }
end
# => -e:2: syntax error, unexpected keyword_BEGIN

====[a:END] END

//emlist[例][ruby]{...

BasicSocket#getpeereid -> [Integer, Integer] (12.0)

Unix ドメインソケットにおいて接続相手の euid と egid を 返します。

...い場合の返り値は
不定です。

require 'socket'

Socket.unix_server_loop("/tmp/sock") {|s|
begin
euid, egid = s.getpeereid

# Check the connected client is myself or not.
next
if euid != Process.uid

# do something about my resource.
ensure...

絞り込み条件を変える

ruby 1.8.4 feature (12.0)

ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。

...:"bar?"
# => ruby 1.8.4 (2005-12-22) [i686-linux]
:foo!
:bar?

4) :$- always treats next character literally:

p eval(":$-\n") # => :"$-\n"
p :$-( # => :"$-("
p :$- # => :"$- "
p :$-#.ob...
...せずに待ち続けてしまう可能性があるというバグを修正しました.

#
# * ext/tk/lib/multi-tk.rb: kill the meaningless loop for the deleted Tk
# interpreter.

MultiTkIp で生成した Tk インタープリタを削除した後も,
不要となった...