I want to jump to the end of the procedure if an IF statement is true
NzdOrInv := proc (a::integer, m::integer)
if (a > m) then
printf("a > m, cannot proceed. Terminating program.") <-- I WANT TO JUMP TO THE END OF THE PROCEDURE HERE
end if
if gcd(a, m) = 1 then
inverseCalc(a, m)
elif gcd(a, m) > 1 then
compZeroDiv(a, m)
end if
end proc
I've tried inserting a end proc after the line printf("a > m, cannot proceed. Terminating program.") but it doesn't work.
Here are three ways.
I realize that first way below may be closest to what you actually asked. But the third way has an advantage in that a error emitted by the failed attempt can be caught and trapped. This allows you to programmatically determine what Maple might do next, according to whether it failed or not. In other words, in gives you easier control over the overall program flow.