cancel
Showing results for 
Search instead for 
Did you mean: 
  • ×
    Information
    Know the Benefits of your HP account

    Connect with HP support faster, manage all your devices in one place, view warranty information and more– Click Here

    Information
    Fix Windows 10 Update Issues

    Resolve Windows 10 or update issues on HP computer or printer– Click Here

  • post a message
  • ×
    Information
    Know the Benefits of your HP account

    Connect with HP support faster, manage all your devices in one place, view warranty information and more– Click Here

    Information
    Fix Windows 10 Update Issues

    Resolve Windows 10 or update issues on HP computer or printer– Click Here

  • post a message
Highlighted
Level 2
11 7 2 1
Message 1 of 6
1,442
Flag Post

Solved!

HP Prime - How do you get a variable from a program put on the stack?

HP Recommended
HP Prime

Does anyone know how to get a variable created in a program put onto the RPN stack on the HP Prime?

5 REPLIES 5
Highlighted
Level 9
3,551 3,490 180 537
Message 2 of 6
Flag Post
HP Recommended

Hi!, @WDTau :

Try, with the instruction's from this link ... https://h30434.www3.hp.com/t5/Tablets-and-Mobile-Devices-Archive-Read-Only/HP-Prime-using-user-varia...

Kind Regards !.
Have a nice day !.
@Maké (Technical Advisor Premium - HP Program Top Contributor).
Provost in HP Spanish Public Forum ... https://h30467.www3.hp.com/
0 Kudos
Highlighted
Author
Level 2
11 7 2 1
Message 3 of 6
Flag Post
HP Recommended

This does not answer my question as the article only deals with using variables on the stack.

 

I want to have a number or piece of text  left on the stack after a HP Prime program has terminated and that number or piece of text was stored in a variable during the execution of the program.

 

0 Kudos
Highlighted
Level 8
Level 8
746 743 121 184
Message 4 of 6
Flag Post
HP Recommended

The last return value of whatever is in the program will be returned, as will "return" begin called earlier in a program.

 

Only a single value of any type may be returned.

 

EXPORT MyFunction(a)

BEGIN

    IF(a==1) RETURN "a is one";

    "a not 1"

END;

       

 

TW

Although I work for the HP calculator group as a head developer of the HP Prime, the views and opinions I post here are my own.
0 Kudos
Highlighted
Author
Level 2
11 7 2 1
Message 5 of 6
Flag Post
HP Recommended

TW:

 

Your sample program came up with an error so I changed it to:-

 

EXPORT MyFunction(a)
BEGIN
IF(a==1) THEN
RETURN "a is one";
ELSE
RETURN "a not 1";
END;
END;

 

to get it to run.

 

When it runs it displays either "a is one" or "a is not one" in a display box in the centre of the screen, but nothing is returned to the stack (which is what I want).

 

Any ideas on this?

0 Kudos
Highlighted
Level 8
Level 8
746 743 121 184
Message 6 of 6
Flag Post
HP Recommended

When you run a program from the program catalog, it pacakges the restult automatically since there is no where for the result to "go".

 

Call your function from the RPN stack, and the result goes there.

TW

Although I work for the HP calculator group as a head developer of the HP Prime, the views and opinions I post here are my own.
0 Kudos
Tags (1)
Warning Be alert for scammers posting fake support phone numbers and/or email addresses on the community. If you think you have received a fake HP Support message, please report it to us by clicking on "Flag Post".
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation