HP Forums
syntax error but its from HP Prime Exercises..what up with that? - 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: syntax error but its from HP Prime Exercises..what up with that? (/thread-14010.html)



syntax error but its from HP Prime Exercises..what up with that? - tom234 - 11-18-2019 09:52 PM

The error is in ""M; dont know why?
anyone know why?


EXPORT CESAR()
BEGIN
local n;
LOCAL S,M,K;
””M;
//The user is asked to enter the encrypted word
INPUT(n,”Insert in quotation marks”,”Encrypted word”);
SIZE(n)S;
FOR K FROM 1 TO S DO
//This time we shift by 3 letters backwards
M+CHAR(ASC(MID(n,K,1))-3)M;
END;
PRINT(M);
END;


RE: syntax error but its from HP Prime Exercises..what up with that? - pinkman - 11-18-2019 11:45 PM

Hi,
The arrows (sto) are missing, the quotation marks are not the right ones (maybe because of your PC keyboard), and the INPUT command is used the wrong way to input strings.
Where did you find this example?

Here is my proposed correction:

Code:

EXPORT CESAR()
BEGIN
//local n;
LOCAL N,S,M,K;
""▶M;
//The user is asked to enter the encrypted word
INPUT({{N,[2]}}, "Insert without quotation marks", "Encrypted word");
SIZE(N)▶S;
FOR K FROM 1 TO S DO
//This time we shift by 3 letters backwards
M+CHAR(ASC(MID(N,K,1))-3)▶M;
END;
PRINT(M);
END;



RE: syntax error but its from HP Prime Exercises..what up with that? - tom234 - 11-18-2019 11:50 PM

I found it in publication:

EXERCISES HP Prime


by:Preparation: MORAVIA Education, a division of MORAVIA Consulting Ltd. http://www.moravia-consulting.com Creation and copyright: Mickaël Nicotera, http://mic.nic.free.fr/
More documents at: http://www.hp-prime.com
Date of issue: 06.2014

The language changed that much since 22014?

thank you.


RE: syntax error but its from HP Prime Exercises..what up with that? - Tim Wessman - 11-19-2019 01:09 AM

(11-18-2019 11:50 PM)tom234 Wrote:  I found it in publication:

EXERCISES HP Prime


by:Preparation: MORAVIA Education, a division of MORAVIA Consulting Ltd. http://www.moravia-consulting.com Creation and copyright: Mickaël Nicotera, http://mic.nic.free.fr/
More documents at: http://www.hp-prime.com
Date of issue: 06.2014

The language changed that much since 22014?

thank you.

No, i suspect the font is not embedded/installed and whatever you are viewing with shows nothing for unknown characters.


RE: syntax error but its from HP Prime Exercises..what up with that? - tom234 - 11-19-2019 11:49 AM

Your line is see as input in HP Prime for Alegerbra and in other programs like dist2:
INPUT({{N,[2]}}, "Insert without quotation marks", "Encrypted word");
TY


RE: syntax error but its from HP Prime Exercises..what up with that? - tom234 - 11-19-2019 01:03 PM

EXPORT AA()
BEGIN
LOCAL A,L;
L:=[]; (this line has a error inside the box is this syntax out of date?)
REPEAT
REPEAT
A:=GETKEY;
UNTIL A!=-1;
L:=CONCAT(L,A);
UNTIL ISKEYDOWN(48);
RETURN L;
END;



Symbolic computation
and
Mathematics
with
the calculator HP Prime
Renée De Graeve
Lecturer at Grenoble on page 497

Is this texts words out of date with software programing lauguage in use now?


RE: syntax error but its from HP Prime Exercises..what up with that? - Eddie W. Shore - 11-19-2019 01:28 PM

Are only empty lists allowed?

Yes: { }
No: [ ] (empty vectors)


RE: syntax error but its from HP Prime Exercises..what up with that? - tom234 - 11-19-2019 01:37 PM

(11-19-2019 01:28 PM)Eddie W. Shore Wrote:  Are only empty lists allowed?

Yes: { }
No: [ ] (empty vectors)

why would HP allow wrong computer code that does not work in their instruction books?


RE: syntax error but its from HP Prime Exercises..what up with that? - Tim Wessman - 11-19-2019 03:32 PM

It is not an HP book nor site. Smile

Talk to the author.


RE: syntax error but its from HP Prime Exercises..what up with that? - tom234 - 11-19-2019 08:18 PM

(11-19-2019 03:32 PM)Tim Wessman Wrote:  It is not an HP book nor site. Smile

Talk to the author.

Ty

are there any publications by HP that show the proper syntax for programming language?


RE: syntax error but its from HP Prime Exercises..what up with that? - StephenG1CMZ - 11-19-2019 08:48 PM

You will find useful information within the user guides and tutorials here (note that not all is official HP) :
https://www.hpmuseum.org/forum/thread-818.html?highlight=Eddie+shore


RE: syntax error but its from HP Prime Exercises..what up with that? - pinkman - 11-19-2019 10:03 PM

(11-19-2019 08:18 PM)tom234 Wrote:  are there any publications by HP that show the proper syntax for programming language?

Try also pressing the HELP button, it is really useful.


RE: syntax error but its from HP Prime Exercises..what up with that? - Tim Wessman - 11-20-2019 01:13 AM

There are also a lot of built in progam examples in the calculator itself ready to load in and run/study. In the "New" screen when making a program, press "Example" to pick one.