2 ms·
If a function does different things in different circumstances it should usually be split into different functions. Languages like Erlang which can have differ
by SoftTalker 2y ago
If a function does different things in different circumstances it should usually be split into different functions.
Languages like Erlang which can have different versions of a function, selected by pattern matching (with optional guards) make this convenient:
Name(Pattern11,...,Pattern1N) [when GuardSeq1] ->
Body1;
...;
Name(PatternK1,...,PatternKN) [when GuardSeqK] ->
BodyK.