Maple does not have a GOTO. I do ?goto and nothing comes up (I thought it did at one point, but it seems to be gone). I also saw
99052-How-To-Write-Procedures-That-Use-Go-To-In-Maple
GOTO is considered bad, and I agree in general. But there ONE very good use for GOTO which can't be easily replaced, which is having a common exit label. (at one work place sometime ago, this was actually the only recommened use for it in the programming guidelines. and I agree.)
Without this, one ends up with deep if then else if then else if then else., etc....
But having a common exit, where one can do common clean up things is very good. This reduced code duplication and actually makes the logic more clear.
Here is just some silly example to illustrate
foo:=proc(x)
if x=10 then
.....
close file, print common message
return(final_result);
fi;
if x=12 then
.....
close file, print common message
return(final_result);
fi;
etc...
end proc;
With common exit point, one could do
foo:=proc(x)
if x=10 then
.....
final_result :=...
goto common_exit;
fi;
if x=12 then
.....
final_result :=...
goto common_exit;
fi;
common_exit:
close file;
print common message;
return(final_result);
end proc;
The alternative is to have deep nested if then else, like this
foo:=proc(x)
if x=10 then
.....
final_result :=...;
else
if x=12 then
.....
final_result :=...;
else
if x= 20 then
.....
final_result :=...;
fi;
fi;
fi;
close file;
print common message;
return(final_result);
end proc;
For complicated logic, I do not think the last case is better than the second one using GOTO.
The second case also eliminates duplicate code as was done in first case. Also first case has multiple return points from the proc, which is not good. As having one common return point is better.
Why was goto removed from Maple? Can one still use it somehow? Where is the documenation for it?
update
goto seems to be there. I did not think of trying, since ?goto did not show it. But now I found I could do this and it works
foo:=proc()
local x;
x:=10;
goto(common_exit);
x:=20;
common_exit:
print(x);
end proc;
So please Maplesoft., do not remove GOTO.