688 Programming
2. Supply the variables, and then run the program.
Letting the user supply the values as arguments
This method lets users pass one or more values as arguments within the
expression that calls the program or function.
The following program, , calculates the volume of a cylinder. It requires
the user to supply two values: height and radius of the cylinder.
1. Define the program.
2. Run the program to display the volume of a cylinder with a height of
34 mm and a radius of 5 mm.
Note: You do not have to use the parameter names when you run the
program, but you must supply two arguments (as values, variables, or
expressions). The first must represent the height, and the second must
represent the radius.
Requesting the values from the user (programs only)
You can use the and commands in a program to make the program
pause and display a dialog box prompting the user for information. This
method does not require users to remember variable names or the order
in which they are needed.
You cannot use the or command in a function.
1. Define the program.
(height,radius) =
"Volume =", (
p ¦ radius
2
¦ height)
(34,5) Volume = 534.071
"Width: ",
"Height: ",