Handling data, Input data, Output data – HP 49g Graphing Calculator User Manual

Page 192: How a program flows, Handling data -6, Input data -6 output data -6, How a program flows -6

Attention! The text in this document has been recognized automatically. To view the original document, you can use the "Original mode".

Advertising
background image

Handling data

This section briefly describes how you can supply data to your programs,

and how you can output data that your programs produce.

Input data

You can use one of the following methods to specify the data that you
want your program to use:

® as argiunents when you run the program

® as variables that you create in memory before you rrm the program

® by prompting for input as the program runs.

-

See ’’Using fimctions that require arguments” on page 10-5 for an
example of using the INPUT fimction to prompt for data.

-

When you use a fimction such as INPUT to collect numeric data

while the program nins, the data is returned as a string. You need to

convert it to a number using a fmiction such as OBJ—>.

Output data

Data that is output in algebraic mode is written to the history. Note the

following points regarding output:

® Wlien the program completes, the history displays the last output only.

This is displayed at level 1. To retain outputs created during
processing, you can write the output to a global variable or variables as
the program progresses. This method gives you the flexibility to fonnat
the output, and to add comments to improve clarity.

® Some fimctions retimi multiple values. For these fimctions, values are

written to a list. Unless you output to a variable, the list appears on the
history.

How a program flows

HP 49G programs have one entrance point—at the beginning of the
program—and one exit point—at the end of the program. There is no

command such as GOTO that you can use to jump to a point within a

program. Within a program, you use looping and branching structures

such as IF THEN to control the order of operations. See ’’Conditional and
looping structures” on page 10-13 for details.

Page 10-6

Introduction to programming

Advertising