I'm starting with elixir but I'm having some issues while using pattern matching.
Suppose I want to declare a map such as:
var = %{
y: Float.parse("3.4"),
z: Float.parse("7.8")
}
To achieve the following result:
var = %{
y: 3.4,
z: 7.8
}
Taking into account that Float.parse returns {floatVal, _}. how can I do this without declaring temporary variables?
Is code below the only way to achieve this?
var = %{
y: Float.parse("3.4") |> elem(0),
z: Float.parse("7.8") |> elem(0),
}