help programming - 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: help programming (/thread-956.html) help programming - Arcturus314 - 03-22-2014 05:43 PM So I wrote a program that is giving me a syntax error: EXPORT PROG1(A,B,C) BEGIN LOCAL D=0; LOCAL E=0; (-B+SQUAREROOT(B^2-4AC))/(2A)->D; (-B-SQUAREROOT(B^2-4AC))/(2A)->E; MSGBOX(D,E); END; squareroot is replaced by the square root symbol in the code So what is the problem? RE: help programming - Han - 03-22-2014 05:49 PM (03-22-2014 05:43 PM)Arcturus314 Wrote:  So I wrote a program that is giving me a syntax error: EXPORT PROG1(A,B,C) BEGIN LOCAL D=0; LOCAL E=0; (-B+SQUAREROOT(B^2-4AC))/(2A)->D; (-B-SQUAREROOT(B^2-4AC))/(2A)->E; MSGBOX(D,E); END; squareroot is replaced by the square root symbol in the code So what is the problem? I presume that -> is the actual store arrow. The problem (based solely on your source code) is that MSGBOX() only takes a single argument. You've separated D and E as two arguments and there is no such instance of MSGBOX() using two arguments. Instead, try: MSGBOX({D,E}). RE: help programming - Ben Fairbank - 03-22-2014 05:51 PM Have you tried putting a multiplication symbol (*) between the 4 and the A and the A and the C, and the 2 and he A? BAF (03-22-2014 05:43 PM)Arcturus314 Wrote:  So I wrote a program that is giving me a syntax error: EXPORT PROG1(A,B,C) BEGIN LOCAL D=0; LOCAL E=0; (-B+SQUAREROOT(B^2-4AC))/(2A)->D; (-B-SQUAREROOT(B^2-4AC))/(2A)->E; MSGBOX(D,E); END; squareroot is replaced by the square root symbol in the code So what is the problem? RE: help programming - Arcturus314 - 03-22-2014 05:51 PM Thank you, that fixed it! I didn't know that msgbox only accepted 1 argument. I also assumed it would multiply variables automatically. RE: help programming - Tim Wessman - 03-22-2014 06:13 PM When you press the "CHECK" button, where did the cursor go? My guess is it put it right on the message box. RE: help programming - Arcturus314 - 03-22-2014 06:25 PM (03-22-2014 06:13 PM)Tim Wessman Wrote:  When you press the "CHECK" button, where did the cursor go? My guess is it put it right on the message box. Yep. Just tested it.