Identifying output in programs, Tagging a numerical result, De-tagging” a tagged quantity – HP 50g Graphing Calculator User Manual

Page 680: Identifying output in programs ,21-33, De-tagging” a tagged quantity ,21-33

Advertising
background image

Page 21-33

commands “Operation cancelled” MSGBOX will show a message box
indicating that the operation was cancelled.

Identifying output in programs

The simplest way to identify numerical program output is to “tag” the program
results. A tag is simply a string attached to a number, or to any object. The
string will be the name associated with the object. For example, earlier on,
when debugging programs INPTa (or INPT1) and INPT2, we obtained as
results tagged numerical output such as :a:35.

Tagging a numerical result

To tag a numerical result you need to place the number in stack level 2 and the
tagging string in stack level 2, then use the

→TAG function („ ° @)TYPE@ @

TAG) For example, to produce the tagged result B:5., use:

5`‚Õ~b„ °

@)TYPE@ @ TAG

Decomposing a tagged numerical result into a number and a tag

To decompose a tagged result into its numerical value and its tag, simply use
function OBJ („°

@)TYPE@ @OBJ @). The result of decomposing a tagged

number with

→OBJ is to place the numerical value in stack level 2 and the tag

in stack level 1. If you are interested in using the numerical value only, then
you will drop the tag by using the backspace key ƒ. For example,
decomposing the tagged quantity B:5 (see above), will produce:

“De-tagging” a tagged quantity

“De-tagging” means to extract the object out of a tagged quantity. This
function is accessed through the keystroke combination: „ °

@)TYPE@ L

@DTAG. For example, given the tagged quantity a:2, DTAG returns the
numerical value 2.

Advertising