Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

November 14th, 2023

2023_11_14.livemd

November 14th, 2023

Case

# structure = [1, 2, 3]
# structure = {1, 2, 3}
# structure = %{"one" => :two, 3 => "four"}
magic_number = 42
structure = 42

case structure do
  [head | _tail] -> head
  {element, _, _} -> element
  %{"one" => value} -> value
  ^magic_number -> "It is the magic number"
  _ -> :error
end