Template compatibility is a good way to refactor case case - you can do something like this
testcase(1, X, Y) -> .... passed1; testcase(2, X, Y) -> .... passed2; testcase(N, X, Y) when N > 2 -> .... passedlarge; testcase(_, X, Y) -> defaultcase.
and then your case statement just completes:
X = testcase(Number, Param1, Param2).
(in this far-fetched example, X will either be passed, or passed2, or passed too large or by default)
Alan moore
source share