HP 48GX STO Error: Undefined Local Name
|
06-12-2021, 01:02 AM
(This post was last modified: 06-12-2021 01:21 AM by MNH.)
Post: #1
|
|||
|
|||
HP 48GX STO Error: Undefined Local Name
I'm not comprehending what's going on with STO Error: Undefined Local Name.
Pressing the menu key labeled 'R' causes the message to be displayed. \<< 0 → radius \<< CLLCD " AREA OF A CIRCLE" 3 DISP 3 FREEZE { { "R" \<< 'radius' STO \>> } } TMENU \>> \>> I've defined the local name. Is the location where I call it "out of scope?" I know the program is incomplete; I stopped writing it when I encountered the error. |
|||
06-12-2021, 02:37 AM
Post: #2
|
|||
|
|||
RE: HP 48GX STO Error: Undefined Local Name
Your program assigns << 'radius' STO >> to the F1 key (and labels it R). The variable 'radius' in that program, due to the way it was created, is a local variable. But when your program ends, that local variable is automatically purged. But pressing the F1 key ("R") attempts to store into that local variable which no longer exists. One way around this is to avoid exiting the program via a HALT command, and resuming it via the CONT key (left-shift ON). That's ugly though. In any case, 'radius' fails because you're using it outside of its defining procedure (namely, the original program which is no longer running when you press your softkey).
<0|ɸ|0> -Joe- |
|||
06-12-2021, 09:39 AM
(This post was last modified: 06-12-2021 01:01 PM by Giuseppe Donnini.)
Post: #3
|
|||
|
|||
RE: HP 48GX STO Error: Undefined Local Name
(06-12-2021 02:37 AM)Joe Horn Wrote: One way around this is to avoid exiting the program via a HALT command, and resuming it via the CONT key (left-shift ON). That's ugly though. I beg to disagree. This is actually quite an elegant solution, if you recall that CONT is a programmable command and that you can include it as part of a menu key definition. Even Bill Wickes recommends its use in the present context. Also, instead of DISP, FREEZE, and HALT, I would use PROMPT, because it has the advantage of leaving the displayed message visible during command line entry. Otherwise, the message will vanish at the next keystroke. You could, for example, write something like this: Code: \<< 0 \-> radius For further discussion and ideas, I strongly recommend reading chapter 12.6 entitled “Obtaining Input” from Bill Wickes’ HP 48 Insights - I. Principles and Programming (starting on page 361 in the GX edition of the book, and on page 329 in the SX edition, a free copy of which is available on Eric Rechlin’s new webpage dedicated to HP literature. |
|||
06-12-2021, 11:32 AM
Post: #4
|
|||
|
|||
RE: HP 48GX STO Error: Undefined Local Name
(06-12-2021 02:37 AM)Joe Horn Wrote: In any case, 'radius' fails because you're using it outside of its defining procedure (namely, the original program which is no longer running when you press your softkey). This was just a test program. Page 1 of the program that I want to write has 6 input choices. I would like to use local variables to store values. I've used local variables before, but never with a menu. Thanks for replying! |
|||
06-12-2021, 11:39 AM
Post: #5
|
|||
|
|||
RE: HP 48GX STO Error: Undefined Local Name
(06-12-2021 09:39 AM)Giuseppe Donnini Wrote: For further discussion and ideas, I strongly recommend reading chapter 12.6 entitled “Obtaining Input” from Bill Wickes’ HP 48 Insights - I. Principles and Programming (starting on page 361 in the GX edition of the book, and on page 329 in the SX edition, a free copy of which is available on Eric Rechlin’s new webpage dedicated to HP literature. I will give your program a test run. Thanks for recommending Bill's book! |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)