HP Forums

Full Version: syntax error but its from HP Prime Exercises..what up with that?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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;
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;
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.
(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.
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
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?
Are only empty lists allowed?

Yes: { }
No: [ ] (empty vectors)
(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?
It is not an HP book nor site. Smile

Talk to the author.
(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?
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-81...ddie+shore
(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.
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.
Reference URL's