Creating Programs On A Computer; Using Local Variables; Creating Local Variables - HP 48gII Advanced User's Reference Manual

Graphing calculator
Hide thumbs Also See for 48gII:
Table of Contents

Advertisement

@%SPH% ˜
Press − to stop viewing.

Creating Programs on a Computer

It is convenient to create programs and other objects on a computer and then load them into the hp49g+/hp48gII.
If you are creating programs on a computer, you can include "comments" in the computer version of the
program.
To include a comment in a program:
Enclose the comment text between two @ characters.
!
or
Enclose the comment text between one @ character and the end of the line.
!
Whenever the hp49g+/hp48gII processes text entered in the command line — either from keyboard entry or
transferred from a computer — it strips away the @ characters and the text they surround. However, @
characters are not affected if they're inside a string.

Using Local Variables

The program SPH in the previous example uses global variables for data storage and recall. There are
disadvantages to using global variables in programs:
After program execution, global variables that you no longer need to use must be purged if you want to clear
!
the VAR menu and free user memory.
You must explicitly store data in global variables prior to program execution, or have the program execute
!
STO.
Local variables address the disadvantages of global variables in programs. Local variables are temporary
variables created by a program. They exist only while the program is being executed and cannot be used outside
the program. They never appear in the VAR menu. In addition, local variables are accessed faster than global
variables. (By convention, this manual uses lowercase names for local variables.) A compiled local variable is a
form of local variable that can be used outside of the program that creates it. See "Compiled Local Variables" on
page 1-10 for more information.

Creating Local Variables

In a program, a local variable structure creates local variables.
To enter a local variable structure in a program:
1. Enter the " command (press @é).
2. Enter one or more variable names.
3. Enter a defining procedure (an algebraic or program object) that uses the names.
«  name
... name
name
1
2
or
«  name
... name
name
1
2
When the " command is executed in a program, n values are taken from the stack and assigned to variables
, .... name
.
name
name
1
2
n
For example, if the stack looks like this:
' algebraic ' »
n
« program » »
n
RPL Programming 1-7

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

49g+

Table of Contents