diff options
Diffstat (limited to 'docs/posts/ruby-then-keyword-and-case-in')
| -rw-r--r-- | docs/posts/ruby-then-keyword-and-case-in/index.html | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/docs/posts/ruby-then-keyword-and-case-in/index.html b/docs/posts/ruby-then-keyword-and-case-in/index.html index 08e90bd..c485f68 100644 --- a/docs/posts/ruby-then-keyword-and-case-in/index.html +++ b/docs/posts/ruby-then-keyword-and-case-in/index.html @@ -7,11 +7,7 @@ <title>[Ruby] then キーワードと case in - REPL: Rest-Eat-Program Loop</title> - <meta name="description" content="この記事は Qiita から移植してきたものです。 元 URL: https://qiita.com/nsfisis/items/787a8cf888a304497223 - TL; DR case - in によるパターンマッチング構文でも、case - when と同じように then が使える (場合によっては使う必要がある)。 -then とは 使われることは稀だが、Ruby では then がキーワードになっている。次のように使う: -if cond then puts "Y" else puts "N" end このキーワードが現れうる場所はいくつかあり、if、unless、rescue、case 構文がそれに当たる。 上記のように、何か条件を書いた後 then を置き、式がそこで終了していることを示すマーカーとして機能する。 -# Example: if x then a end unless x then a end begin a rescue then b end case x when p then a end なぜ普段は書かなくてもよいのか 普通 Ruby のコードで then を書くことはない。なぜか。次のコードを実行してみるとわかる。"> + <meta name="description" content="この記事は Qiita から移植してきたものです。 元 URL: https://qiita.com/nsfisis/items/787a8cf888a304497223 TL; DR case - in によるパターンマッチング構文でも、case - when と同じように then が使える (場合によっては使"> <meta name="author" content=""> <link href="https://blog.nsfisis.dev/an-old-hope.min.css" rel="stylesheet"> |
