HP Prime Programming: LOCAL



#2

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.


#3

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.


#4

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.

#5

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 320 11-29-2013, 05:46 AM
Last Post: Marek Russ
  HP Prime - local variables retain their initial type BruceH 4 309 11-10-2013, 12:42 PM
Last Post: Michael de Estrada
  hp prime - programming with lists giancarlo 3 284 11-10-2013, 02:13 AM
Last Post: Giancarlo
  HP Prime Programming Tutorial #3: WHILE, INPUT, KILL, REPEAT, GETKEY Eddie W. Shore 5 394 11-07-2013, 12:25 AM
Last Post: Han
  HP Prime - programming bluesun08 2 230 11-04-2013, 04:31 PM
Last Post: bluesun08
  More undocumented programming limitations in the HP Prime Michael de Estrada 3 282 11-03-2013, 08:22 PM
Last Post: Michael de Estrada
  HP Prime questions: I/O and Meta programming Andy Gryc 2 254 10-31-2013, 11:22 PM
Last Post: Andy Gryc
  HP Prime Programming Tutorial #1: LOCAL, RETURN Eddie W. Shore 6 436 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 200 10-26-2013, 03:51 PM
Last Post: Eddie W. Shore
  HP Prime : Programming and the Comma Miguel Toro 7 470 10-25-2013, 12:18 PM
Last Post: Miguel Toro

Forum Jump: