HP Forums
Number of Variables? - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Number of Variables? (/thread-4085.html)

Number of Variables? - Gene222 - 06-05-2015 03:56 PM

Is there a limit on the number of variables you can create in a program using the local or export commands?

RE: Number of Variables? - Tim Wessman - 06-05-2015 04:10 PM

I believe something is limited there based on the size of the count object for variables, but this will be something like 2^16 or so. Don't expect you will be hitting that very quickly...

However, you do have a limit of 8 per command block call. Functions/commands can have 16 arguments. When you do a LOCAL call, it will take 8 variable names, and up to 8 arguments for those.

LOCAL a1, a2, a3, a4, a5:=1, a6, a7, a8; //good
LOCAL a1, a2, a3, a4, a5:=1, a6, a7, a8, a9; //no good
(in actuallity these are both like this internally)
LOCAL a1(:=0), a2(:=0), a3(:=0), a4(:=0), a5:=1, a6(:=0), a7(:=0), a8(:=0)...;

So you can see how it is limited to 8 in each "block".