Answers for "why use elixir"

2

elixir if statement

iex> if true do
...>   "This works!"
...> end
"This works!"

iex> unless true do
...>   "This will never be seen"
...> end
nil

iex> if nil do
...>   "This won't be seen"
...> else
...>   "This will"
...> end
"This will"
Posted by: Guest on February-24-2021
0

elixir function arity

inspect :erlang.fun_info(fn -> :ok end)[:arity] 
inspect :erlang.fun_info(fn a,b-> a+b end)[:arity] 
inspect fn a,b-> a+b end |> is_function 
inspect fn a,b-> a+b end |> is_function(1)
Posted by: Guest on August-06-2020

Browse Popular Code Answers by Language