11件ヒット
[1-11件を表示]
(0.056秒)
検索結果
先頭1件
-
制御構造 (15075.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などとは異なり)制御構造は式であ......break により while 修飾した式の戻り値を
その値にすることもできます。
====[a:until] until
//emlist[例][ruby]{
until f.eof?
print f.gets
end
//}
文法:
until 式 [do]
...
end
式を評価した値が真になるまで、本体を繰......ure 節を定義でき、これにより例外を処理することが
できます。
==== rescue修飾子
//emlist[例][ruby]{
open("nonexistent file") rescue STDERR.puts "Warning: #$!"
//}
文法:
式1 rescue 式2
式1で例外が発生したとき、式2を評価します。
以...