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)
How to prompt?
Re: How to prompt?
OK solved.
I added the PROMPT in Aplha mode. It must be XEQ PROMPT.
Thank You.
I added the PROMPT in Aplha mode. It must be XEQ PROMPT.
Thank You.
Re: How to prompt?
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:
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...)
Code: Select all
LBL "AREA"
"R=?"
CLx
PROMPT
STO 01
x^2
PI
x
RTN
END
There are only 10 kinds of people in the world: those who understand binary and those who do not.
Re: How to prompt?
Thx grsbanks. I will follow your tip.
-
- Posts: 137
- Joined: Wed Jun 14, 2017 9:27 pm
Re: How to prompt?
For prompting, I usually like this kind of pattern (assuming the value of R is stored in register 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.
Code: Select all
"R?"
RCL 00
ARCL X
PROMPT
STO 00
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: How to prompt?
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.