We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
==
相等判断的基本用法
iex(3)> 2 == 2 true
另一种用法
iex(4)> Kernel.==(2, 2) true
== 其实是Kernel内建的函数只是函数名有点怪。
参考代码
def is_valid_card(card_type, card_number) do case card_type do :debit -> card_number |> Integer.to_charlist() |> length |> Kernel.==(12) :credit -> card_number |> Integer.to_charlist() |> length |> Kernel.==(10) _ -> {:error, :invalid_card_type} end end
https://medium.com/blackode/2-biggest-exunit-improvements-in-elixir-1-7-9116f7209c90
The text was updated successfully, but these errors were encountered:
No branches or pull requests
相等判断的基本用法
另一种用法
==
其实是Kernel内建的函数只是函数名有点怪。参考代码
https://medium.com/blackode/2-biggest-exunit-improvements-in-elixir-1-7-9116f7209c90
The text was updated successfully, but these errors were encountered: