|
|
|
|
|
by elcritch
2607 days ago
|
|
IMHO, better but it’s still confusing when you have multiple places where you name the variable. Functional programming style forces you to be more explicit and pushes you to separate out the assignment expression. In Elixir I’d do: myVar =
cond do
cond1 -> 1
cond2 && cond3 -> 10
cond2 && !cond3 -> 100
true -> 4
end
ML languages have similar constructs. |
|