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.
restart:
NzdOrInv := proc(a::integer, m::integer)
if (a > m) then
printf("a > m, cannot proceed. Terminating program.");
return NULL;
end if;
if gcd(a, m) = 1 then
inverseCalc(a, m);
elif gcd(a, m) > 1 then
compZeroDiv(a, m);
end if;
end proc:
NzdOrInv( 5, 3 );
a > m, cannot proceed. Terminating program.
restart:
NzdOrInv := proc(a::integer, m::integer)
if (a > m) then
printf("a > m, cannot proceed. Terminating program.");
elif gcd(a, m) = 1 then
inverseCalc(a, m);
elif gcd(a, m) > 1 then
compZeroDiv(a, m);
end if;
end proc:
NzdOrInv( 5, 3 );
a > m, cannot proceed. Terminating program.
restart:
NzdOrInv := proc(a::integer, m::integer)
if (a > m) then
error "a > m, cannot proceed.";
elif gcd(a, m) = 1 then
inverseCalc(a, m);
elif gcd(a, m) > 1 then
compZeroDiv(a, m);
end if;
end proc:
NzdOrInv( 5, 3 );
Error, (in NzdOrInv) a > m, cannot proceed.
try
NzdOrInv( 5, 3 );
catch "a > m, cannot proceed":
print("some new calculation...");
end try;
"some new calculation..."