New answers tagged

3

Here is a direct translation of your if expressions using Mathematica's Which: a = 1; b = 2; c = 3; d = 4; Which[ (a < 4 || b > 5) && ((c == 3 || d <= 6) && (c + d < 10)), a = 10; b = 20; c = 30; d = 40, (a <= 2) && (c == 3 || d <= 6), a = 100; b = 200; c = 300; d = 400, True, a = 1000; b = 2000; ...


0

The Mathematica commands If and And should do the trick: If[query, "if true, run this code", "if false, run this code"] Using two If functions should do the trick. The function And should be pretty self-explanatory. As a beginner, putting a question mark (?) before any function will give you a rundown of it.



Top 50 recent answers are included