RosettaCodeData/Task/Extend-your-language/Mathematica/extend-your-language-1.math

10 lines
245 B
Plaintext

If2[test1_, test2_, condBoth_, cond1_, cond2_, condNone_] := With[
{result1 = test1,
result2 = test2},
Which[
result1 && result2, condBoth,
result1, cond1,
result2, cond2,
True, condNone]];
SetAttributes[If2, HoldAll];