HP Forums

Full Version: Creating array inside program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
HI all,

Would you be kind enough as to explain why I can't create an array using a FOR loop like this?
Code:

EXPORT TEST()
BEGIN
LOCAL c, G;
FOR c FROM 1 to 3 DO
      G(c):=c^2+1;
END;
RETURN G(1)+G(3);
END;
Prime will complain there is an invalid input.

THanks
I see a local variable G (initialized to real number of 0 by default if nothing else is given) and not a vector/array...

LOCAL G:=[0];
Smile
Thanks
Reference URL's