hp prime - sending program results to the stack


Just received my prime TODAY and very very happy with it. Thanks to Tim and Cyrille and HP for the huge amount of work done sofar.

I wrote a small program and i would like to send the result of the calculation to the stack.

In the user guide i found three ways for showing the data:

1) Print which feeds the terminal that can be accessed through ON+T keys when the program ends

2) msgbox with a pop up box.

3) EXPORTing the result variable into the user variables that can be accessed accessing to the variable menu.

Is there a way to send the data directly to the stack?


Giancarlo from Italy


Each function returns a single result on exit. If you are executing it in the home screen, it will return a result automatically (the last item in your program) or else you can use the return keyword.

If you mean to return multiple results separately, then no I don't know any way to do that at the moment.



You can always return a list or matrix.


Hello and thank you for your prompt support.
Here you are my program:









Running that program in rpn/home/functions the output of the program doesn't go into the stack pile. I would like to have the result of the program directly into the stack for further calculations.

Am I doing something wrong?



Ps edited for bad formatting

Edited: 12 Oct 2013, 6:20 p.m.


Returning a list or matrix is also how I would approach returning multiple outputs on to the stack/entry screen.

For tagged results, I use MSGBOX (PRINT could work as well) prior to ending the program. That way you get a summary and still return results to the stack. For examples, say I have A and B as results, the end of a program could look like:

MSGBOX("Result A:"+A);
MSGBOX("Result B:"+B);

or if I want to use PRINT:

PRINT(); // optional
PRINT("Result A:"+A); // add optional args. like color and font size if desired
PRINT("Result B:"+B);
RETURN {A,B}; // I don't think FREEZE or WAIT is required

Edited: 13 Oct 2013, 9:51 a.m.


If you run a program from the HOME entry line, you will get the return value on the stack. If you run it from the program menu, you will only get the answer back in a message box. Any variable you have exported in your program will be available no matter which way you run the program.


Hello guys,
Thank you very much. Running the program from the stack leaves the result in the stack ready for further calculations.

This is esactly what i was looking for.


Giancarlo from Italy

Possibly Related Threads...
Thread Author Replies Views Last Post
  Sending little images to the Prime (...and Program name bug?) Erwin Ried 19 2,958 12-10-2013, 05:35 PM
Last Post: Erwin Ried
  Problem with debug HP prime program, somebody help me? Carlos CM (Mexico) 6 1,419 12-05-2013, 03:07 PM
Last Post: Carlos CM (Mexico)
  HP PRIME: APP program code DISAPPEARS !! Joseph Ec 0 449 11-25-2013, 11:35 AM
Last Post: Joseph Ec
  HP 50g - select characters on the stack, copy/paste Sean Freeman 7 1,209 11-20-2013, 07:11 AM
Last Post: Sean Freeman
  Prime: Placing more than 1 item on the RPN stack in a single program? John Colvin 4 929 11-19-2013, 08:59 AM
Last Post: Miguel Toro
  Prime: Program size limited to 64K? Erwin Ried 4 863 11-17-2013, 11:42 PM
Last Post: Joseph Ec
  [HP-Prime] Picking elements from a List in a program Jean-Michel 3 813 11-15-2013, 04:16 AM
Last Post: dg1969
  HP Prime: Recommendation for future RPN Program Mode BruceTTT 3 843 11-13-2013, 10:03 PM
Last Post: BruceTTT
  HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 1,111 11-11-2013, 08:28 PM
Last Post: Davi Ribeiro de Oliveira
  emu48 - copy stack doesn't work (as expected) Thomas Radtke 2 898 11-11-2013, 02:19 PM
Last Post: Thomas Radtke

Forum Jump: