Print to stack - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Print to stack (/thread-19037.html) |
Print to stack - forexbob - 10-28-2022 12:04 AM Hi again, The rookie is back with another question or so. I'm trying to print to the stack from a program. Everything online seems to make it look easy enough. However I can't get hardly anything to work. Code:
This is a simple enough program but it does not return anything to the stack except the name of the program and the digit "1" which I assume means the program terminated correctly. I've tried printing from the command line but if I don't get a Syntax Error I get nothing but again, the name of the program and the digit "1". I've tried various options both in Home and CAS...no joy. What do I need to do to print a program result to the stack? Is it another one of the excessively complicated DIMGROB situations? Thanks for your help RE: Print to stack - Ioncubekh - 10-28-2022 12:22 AM Code: EXPORT demo(a,b) // x2 arguments required by program named demo At home screen type demo("cat", "cow") demo(3,2) //numerals only RE: Print to stack - pinkman - 10-28-2022 12:25 AM “STRING” is a command of the Prime. Try replacing “STRING” with something else. RE: Print to stack - forexbob - 10-28-2022 03:15 PM (10-28-2022 12:22 AM)Ioncubekh Wrote: Thanks, this almost worked. It only sends item B to the stack and omits item A. It's frustrating that something so simple can turn to be so complicated. Any ideas on that? Thanks again, Bob RE: Print to stack - jfelten - 10-28-2022 04:10 PM (10-28-2022 03:15 PM)forexbob Wrote:(10-28-2022 12:22 AM)Ioncubekh Wrote: try this: Code: EXPORT demo(a, b) RE: Print to stack - forexbob - 10-28-2022 04:54 PM (10-28-2022 04:10 PM)jfelten Wrote:(10-28-2022 03:15 PM)forexbob Wrote: Thanks, this almost worked. It only sends item B to the stack and omits item A. It's frustrating that something so simple can turn to be so complicated. Any ideas on that? This does return the two input values to the stack in a list but I was hoping to have the values returned to different levels in the stack. i.e Result "a" on level 2 and result "b" on level 1. I don't think I explained myself properly initially. Having now been more specific, any ideas? Thanks Bob RE: Print to stack - Guenter Schink - 10-28-2022 07:50 PM (10-28-2022 12:04 AM)forexbob Wrote: Hi again, "PRINT" doesn't print to the stack, guess you're talking about the HOME screen(or CAS screen). "PRINT" prints to the terminal. You can look at the terminal with <On>+<T> For reference: on the Home screen type "PRINT" then push the Help button. HTH, Günter RE: Print to stack - Ioncubekh - 10-28-2022 07:56 PM Code: PRINT("Result A:"+A+" Result B:"+B+"); RE: Print to stack - Eddie W. Shore - 10-29-2022 05:47 AM I think what forexbob is going for is to return results to the RPN Mode stack. I could be wrong, but to my knowledge PPL does not have stack commands in programming mode. RE: Print to stack - Gene222 - 10-29-2022 09:34 PM When running a program and printing the output to the terminal, only the last printed line or expression is sent back to the Home screen as a text object. It makes no difference if the entry mode is textbook or RPN. If you want to use the numeric answers from your program on the Home screen, save your answers into variables. Then use the Var key to insert the variable name into the entry line of the Home screen. To access A through Z variables, use Var key, Home tab, Reals or just type in the variable name. To access exported program variables, use Var key, User tab, Program name, and select the program variable. |