Skip to content

Commit

Permalink
case の挙動の明確化
Browse files Browse the repository at this point in the history
  • Loading branch information
kyanagi committed Nov 1, 2023
1 parent 49df475 commit 632b4ef
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions refm/doc/spec/control.rd
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,12 @@ end
式..]
end

case は一つの式に対する一致判定による分岐を行います。when
節で指定された値と最初の式を評価した結果とを演算子 === を用いて
比較して、一致する場合には when 節の本体を評価します。
case は一つの式に対する一致判定による分岐を行います。
上から順番に、when の直後の式を評価した結果をレシーバ、
case の直後の式を評価した値を引数として === 演算子を呼び出し、
最初に真を返した when 節の本体を実行します。

どの when 節でも条件が成立しなかった場合は、else 節を実行します。

つまり、

Expand Down

0 comments on commit 632b4ef

Please sign in to comment.