HP Forums
HP Prime Programming: LOCAL - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: HP Prime Programming: LOCAL (/thread-252341.html)



HP Prime Programming: LOCAL - Alberto Candel - 10-06-2013

Hello,

Is there a limit to how many arguments a LOCAL command admits?
A program that I am writing has the line

LOCAL A, B, C, I, J, K, X , Y, Z;

and results in a "bad syntax" message, with the cursor right before the Z. With that line replaced by two LOCAL, as

LOCAL A, B, C, I, J, K, X, Y;

LOCAL Z;

my program runs fine. So it seems that 8 is the maximum number of arguments for LOCAL. However page 533 of the User Guide seems to indicate that LOCAL admits any number of arguments.

Thank you.

Edited: 6 Oct 2013, 8:46 p.m.


Re: HP Prime Programming: LOCAL - Tim Wessman - 10-06-2013

Yes, a single call is limited to 8 on one line. Any guess as to the number of bits we had available to use in the "local" command structure?

TW

Edited: 6 Oct 2013, 9:31 p.m.


Re: HP Prime Programming: LOCAL - Han - 10-06-2013

It's probably best that way -- too many and source code becomes less legible. And it only gets worse if local variables are also initialized in the same line they are declared.


Re: HP Prime Programming: LOCAL - cyrille de Brébisson - 10-07-2013

Hello,

Function calls (and LOCAL is a function call) are limited to 16 arguements for 'technical reasons'...

LOCAL (and other variables defintions) are in fact of rht form:
LOCAL(var_name1, var_init_value_1, ... ,va-name_n, var_init_value_n);

if you do not specify init values for your variables, 0 is used...

this is the reason for the 8 local limitations.

the syntax to specify init value is:
LOCAL A=1+2, B=2+3; (or alternatively :=)

cyrille