beautypg.com

Setting a local variable to a value, 81 ^ g, A « 9.81 g « a*g – HP 49g Graphing Calculator User Manual

Page 195: A a « 9.81 -a g 'a+g' » a*g

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

background image

1. On the command line, position the cursor immediately to the right of

the opening « symbol.

2. Press ©0 to insert the —> symbol.

3. Enter a local variable name for each input argmnent your program

uses, separating each with a @.

For example, if your program uses two arguments, and you want to set the

value of these arguments to local variables A and B, the beginning of your
program would appear as follows:

Setting local variables to hold input arguments

« ^ A B

Setting a local variable to a value

After the value, press 00 to insert the

a

symbol, and enter the local

variable name.

For example, to set local variable G to hold 9.81, the acceleration of
gravity, you create the variable as follows:

©@9.8100(H)G

« 9.81 ^ G »

The following example:

• accepts an input argument

• creates the local variable G

• multiplies it by the argument, and places the result on the history.

« ^ A

« 9.81 G

« A*G »

»

In the following example, the

A*G

calculation does not recognize the

local variable G as 9.81, as it is outside the nested procedure where the
variable was declared. The

A+G

calculation recognizes G as 9.81

« -A A

« 9.81 -A G 'A+G' »

A*G

»

Introduction to programming

Page 10-9