0
$\begingroup$

To solve optimization problems I have seen this:

enter image description here

Is there a more elegant way to do this with alternative conditional expressions? Is there something equivelant to if, elseif, else that you'd see in Matlab, Maple, RStudio, Ptyhon, etc?

$\endgroup$
  • 2
    $\begingroup$ Are you asking if there's a more elegant version of If[a, b, If[c, d, e]]? Would Which[a, b, c, d, True, e] qualify? $\endgroup$ – Carl Woll Oct 16 '18 at 17:31
  • 2
    $\begingroup$ Which[] and Switch[] would be of interest. Have you seen this? $\endgroup$ – J. M. will be back soon Oct 16 '18 at 17:33
  • 1
    $\begingroup$ In the future please don't post pictures of code. Please. $\endgroup$ – user6014 Oct 16 '18 at 23:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.