Post Reply 
Creating array inside program
03-04-2015, 10:01 PM
Post: #1
Creating array inside program
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
Find all posts by this user
Quote this message in a reply
03-04-2015, 10:15 PM
Post: #2
RE: Creating array inside program
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];

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
03-04-2015, 10:29 PM
Post: #3
RE: Creating array inside program
Smile
Thanks
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)