User Guide
Procedures with Inputs
You can define a procedure that accepts user input. In the parentheses of the
proc statement, specify the parameter names. For multiple parameters, sep-
arate the names with commas.
geometric_mean := proc(x, y)
sqrt(x*y);
end proc:
>
When the user runs the procedure, the parameter names are replaced by the
argument values.
geometric_mean(13, 17);>
geometric_mean(13.5, 17.1);>
For more information on writing procedures, including options and local
and global variables, refer to the ?procedure help page.
Procedure Return Values
When you run a procedure, Maple returns only the last statement result value
computed. Maple does not return the output for each statement in the proced-
ure. It is irrelevant whether you use semicolons or colons as statement sep-
arators.
p := proc(a, b)
a + b;
a - b:
end proc:
>
8.4 Procedures • 339