logo
  • 教程列表
  • SO官方文檔
  • 條件語句
    • Case
    • 如果和除非
    • 條件
    • 與條款
  1. StackOverflow 文件
  2. Elixir Language 教程
  3. 條件語句
  4. Case

Case

Created: November-22, 2018

 case {1, 2} do
  {3, 4} ->
    "This clause won't match."
  {1, x} ->
    "This clause will match and bind x to 2 in this clause."
  _ ->
    "This clause would match any value."
end

case 僅用於匹配特定資料的給定模式。這裡,{1,2} 與程式碼示例中給出的不同的案例模式匹配。

  • 如果和除非
  • 條件語句

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明