HP Prime Programming: LOCAL
#1

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.

#2

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.

#3

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.

#4

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



Possibly Related Threads…
Thread Author Replies Views Last Post
  Programming workaround for "prepend" HP PRIME Marek Russ 4 1,983 11-29-2013, 05:46 AM
Last Post: Marek Russ
  HP Prime - local variables retain their initial type BruceH 4 1,818 11-10-2013, 12:42 PM
Last Post: Michael de Estrada
  hp prime - programming with lists giancarlo 3 1,845 11-10-2013, 02:13 AM
Last Post: Giancarlo
  HP Prime Programming Tutorial #3: WHILE, INPUT, KILL, REPEAT, GETKEY Eddie W. Shore 5 2,304 11-07-2013, 12:25 AM
Last Post: Han
  HP Prime - programming bluesun08 2 1,434 11-04-2013, 04:31 PM
Last Post: bluesun08
  More undocumented programming limitations in the HP Prime Michael de Estrada 3 1,845 11-03-2013, 08:22 PM
Last Post: Michael de Estrada
  HP Prime questions: I/O and Meta programming Andy Gryc 2 1,479 10-31-2013, 11:22 PM
Last Post: Andy Gryc
  HP Prime Programming Tutorial #1: LOCAL, RETURN Eddie W. Shore 6 2,944 10-26-2013, 08:42 PM
Last Post: Miguel Toro
  HP Prime Programming Tutorial #2: MSGBOX, IF-THEN-ELSE, PRINT, FOR Eddie W. Shore 0 1,230 10-26-2013, 03:51 PM
Last Post: Eddie W. Shore
  HP Prime : Programming and the Comma Miguel Toro 7 2,731 10-25-2013, 12:18 PM
Last Post: Miguel Toro

Forum Jump: