Application Guide

492 Getting Started with the Program Editor
1. Define the volcyl program.
Definevolcyl(height,radius) =
Prgm
Disp "Volume =", approx(p ¦ radius
2
¦ height)
EndPrgm
2. Run the program to display the volume of a cylinder with a height of 34 mm and a
radius of 5 mm.
volcyl(34,5)Volume = 534.071
Note: You do not have to use the parameter names when you run the volcyl
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 Request and RequestStr 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 Request or RequestStr command in a function.
1. Define the program.
Define calculatearea()=
Prgm
Request "Width: ",w
Request "Height: ",h
area:=w*h
EndPrgm
2. Run the program and respond to the requests.
calculatearea() : area
Width: 3 (3 entered as a response)
Height: 23.64(23.64 entered as a response)
70.92
Use RequestStr instead of Request when you want the program to interpret the user’s
response as a character string rather than a math expression. This avoids requiring the
user to enclose the response in quotation marks (““).
Displaying Information from a Function or Program
A running function or program does not display intermediate calculated results unless
you include a command to display them. This is an important difference between
performing a calculation on the entry line and performing it in a function or program.
The following calculations, for example, do not display a result in a function or
program (although they do from the entry line).