The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

HP Prime Programming: LOCAL
Message #1 Posted by Alberto Candel on 6 Oct 2013, 6:52 p.m.

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
Message #2 Posted by Tim Wessman on 6 Oct 2013, 9:30 p.m.,
in response to message #1 by Alberto Candel

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
Message #3 Posted by Han on 6 Oct 2013, 9:43 p.m.,
in response to message #2 by Tim Wessman

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
Message #4 Posted by cyrille de Brébisson on 7 Oct 2013, 1:31 a.m.,
in response to message #1 by Alberto Candel

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


[ Return to Index | Top of Index ]

Go back to the main exhibit hall