Branching instructions are an important element of every programming language. Depending on the value or the meaning of variables, different commands are executed. The simplest variant in MuPAD is the if statement:» for i from 2 to 4 do if isprime(i) then print(expr2text(i).″ is prime″) else print(expr2text(i).″ is not prime″) end_if end_for: ″2 is prime″ ″3 is prime″ ″4 is not prime″
Unable to display preview. Download preview PDF.