HP Forums
QROOT Program creates Syntax Error - 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: QROOT Program creates Syntax Error (/thread-21911.html)



QROOT Program creates Syntax Error - MullenJohn - 06-18-2024 07:49 PM

Help.

I just inputted the QROOTS program into my HP Prime Calculator.

The Program QROOTS

EXPORT QROOTS(A,B,C)
BEGIN
LOCAL D;
PRINT();
HComplex:=1;
D:=B^2-4*A*C;
IF D≥0 THEN
PRINT("Roots are real.");
ELSE
PRINT("Roots are complex.");
END;
PRINT((-B+√D)/(2*A));
PRINT((-B-√D)/(2*A)); END;

This is the error message I am getting "Syntax error in program line 8"

Would you know why? I have tried degugging but to no avail.

Cheers!


RE: QROOT Program creates Syntax Error - toml_12953 - 06-19-2024 01:17 AM

(06-18-2024 07:49 PM)MullenJohn Wrote:  Help.

I just inputted the QROOTS program into my HP Prime Calculator.

The Program QROOTS

EXPORT QROOTS(A,B,C)
BEGIN
LOCAL D;
PRINT();
HComplex:=1;
D:=B^2-4*A*C;
IF D≥0 THEN
PRINT("Roots are real.");
ELSE
PRINT("Roots are complex.");
END;
PRINT((-B+√D)/(2*A));
PRINT((-B-√D)/(2*A)); END;

This is the error message I am getting "Syntax error in program line 8"

Would you know why? I have tried degugging but to no avail.

Cheers!

I copied and pasted your program into both the virtual Prime and physical Prime (G2). It worked fine on both.


RE: QROOT Program creates Syntax Error - MullenJohn - 06-19-2024 01:24 PM

Thank you, Tom!
Could you consider why my HP Prime calculator gives the error message “Syntax error in program line 8”?
The line is ‘ PRINT (“Roots are real.”); ’
I am stumped.
Cheers!


RE: QROOT Program creates Syntax Error - toml_12953 - 06-19-2024 01:42 PM

(06-19-2024 01:24 PM)MullenJohn Wrote:  Thank you, Tom!
Could you consider why my HP Prime calculator gives the error message “Syntax error in program line 8”?
The line is ‘ PRINT (“Roots are real.”); ’
I am stumped.
Cheers!

It's hard to say. The line looks good and copying and pasting it works so I have no clue. You could try deleting it from your calculator and COPY and PASTE the code above like I did.


RE: QROOT Program creates Syntax Error - ftneek - 06-19-2024 01:48 PM

(06-19-2024 01:24 PM)MullenJohn Wrote:  Could you consider why my HP Prime calculator gives the error message “Syntax error in program line 8”?
The line is ‘ PRINT (“Roots are real.”); ’

It appears the issue is the type of quotation mark used. Try "Roots are real." instead of “Roots are real.”, which should prevent the syntax error.


RE: QROOT Program creates Syntax Error - MullenJohn - 06-19-2024 03:02 PM

Thank you, Neek and Tom!
I used the quote marks under key [SHIFT] [9].
I changed to the quote marks under [ALPHA] [0], and it worked like a charm!
The syntax error is gone.
I couldn't have done it without your help.
Program works now.
Thank you for your insight on the quotation marks.
Cheers!