Skip to content

Latest commit

 

History

History
32 lines (28 loc) · 481 Bytes

12.1.md

File metadata and controls

32 lines (28 loc) · 481 Bytes

制御構文を書く前に、関数的な代案を考えること 関数の行数が10行を超えたら要注意

> if 1 == 1, do: "true part", else: "false part"
"true part"
> if 1 == 2, do: "true part", else: "false part"
"false part"
> if 1 == 1 do
> "true part"
> else
> "false part"
> end
"true part"
> unless 1 == 1, do: "error", else: "OK"
"OK"
> unless 1 == 2, do: "OK", else: "error"
"OK"
> unless 1 == 2 do
> "OK"
> else
> "error"
> end
"OK"