How to prompt?

Discussion about the new DM41X calculator
Post Reply
User avatar
waitsee
Posts: 3
Joined: Thu Feb 18, 2021 11:39 pm
Location: Borne

How to prompt?

Post by waitsee »

Hi there,

How to PROMPT for a variable?
I have tried this:
LBL AREA
R=?
CLx
PROMPT
STO 01
x^2
PI
x
RTN
END

This little try out does not show the R=? to add the value.
Between the line number and the R=? and PROMPT there is a little T (to show it is alpha)
User avatar
waitsee
Posts: 3
Joined: Thu Feb 18, 2021 11:39 pm
Location: Borne

Re: How to prompt?

Post by waitsee »

OK solved.
I added the PROMPT in Aplha mode. It must be XEQ PROMPT.
Thank You.
grsbanks
Posts: 1107
Joined: Tue Apr 25, 2017 11:23 am
Location: Preston, Lancs, UK
Contact:

Re: How to prompt?

Post by grsbanks »

Some of that confusion can be avoided by placing quotes around strings that are supposed to be, well, strings rather than commands. So taking your example and making things a little more explicit:

Code: Select all

LBL "AREA"
"R=?"
CLx
PROMPT
STO 01
x^2
PI
x
RTN
END
Also, minor issue, if RTN is the final instruction then you don't need to include it. END does an implicit RTN (says he after just suggesting that some things be made more explicit...)
There are only 10 kinds of people in the world: those who understand binary and those who do not.
User avatar
waitsee
Posts: 3
Joined: Thu Feb 18, 2021 11:39 pm
Location: Borne

Re: How to prompt?

Post by waitsee »

Thx grsbanks. I will follow your tip.
Dave Britten
Posts: 129
Joined: Wed Jun 14, 2017 9:27 pm

Re: How to prompt?

Post by Dave Britten »

For prompting, I usually like this kind of pattern (assuming the value of R is stored in register 00):

Code: Select all

"R?"
RCL 00
ARCL X
PROMPT
STO 00
This will display the "R?" prompt along with the current value of R, and the user can either enter a new value, or hit R/S to reuse the current value. Handy for programs with a lot of input variables where you might want to rerun it a few times and only tweak some of them.
Thomas Okken
Posts: 926
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: How to prompt?

Post by Thomas Okken »

grsbanks wrote:
Fri Feb 19, 2021 4:36 pm
Also, minor issue, if RTN is the final instruction then you don't need to include it. END does an implicit RTN (says he after just suggesting that some things be made more explicit...)
It's just the HP-41C manual which could be more explicit about the fact that END acts just like RTN when executed. It is mentioned, but not nearly as often as it is mentioned that END is the end-of-program indicator, so for people who don't read the manual cover to cover, this tidbit is easy to miss.

So it falls to people like us to point it out every once in a while. :)
Post Reply