HP Forums

Full Version: HP Prime Programming: LOCAL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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.

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.

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.

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