Post Reply 
Array
04-09-2015, 08:27 AM
Post: #1
Array
Hello,

I have crate this simple array read program:

EXPORT test()
BEGIN
Local T45BL = [5128122, 280602, 277693, 173237, 55413,
46271, 32573, 17198, 9266, 8822,
8216, 4324, 4200, -3359, 2463,
2211, 2065, -1870, 1828, -1794,
-1749, -1565, -1491, -1475, -1410,
-1344, -1335, 1107, 1021, 833,
777, 671, 607, 596, 491,
-451, 439, 422, 421, -366,
-351, 331, 315, 302, -283,
-229, 223, 223, -220, -220,
-185, 181, -177, 176, 166,
-164, 132, -119, 115, 107];

for i from 0 to 59 do
print(T45BL[i]);
end;

It it compiling well, but when executed I get the error message
"Bad argument type"

Can someone help me with this?

Thanks for any help.

Jan Kromhout
Hellevoetsluis-NL
Find all posts by this user
Quote this message in a reply
04-09-2015, 10:45 AM
Post: #2
RE: Array
(04-09-2015 08:27 AM)Powersoft Wrote:  Hello,

I have crate this simple array read program:

EXPORT test()
BEGIN
Local T45BL = [5128122, 280602, 277693, 173237, 55413,
46271, 32573, 17198, 9266, 8822,
8216, 4324, 4200, -3359, 2463,
2211, 2065, -1870, 1828, -1794,
-1749, -1565, -1491, -1475, -1410,
-1344, -1335, 1107, 1021, 833,
777, 671, 607, 596, 491,
-451, 439, 422, 421, -366,
-351, 331, 315, 302, -283,
-229, 223, 223, -220, -220,
-185, 181, -177, 176, 166,
-164, 132, -119, 115, 107];

for i from 0 to 59 do
print(T45BL[i]);
end;

It it compiling well, but when executed I get the error message
"Bad argument type"

Can someone help me with this?

Thanks for any help.

Jan Kromhout
Hellevoetsluis-NL

Hello
local T45BL:=[...]
local i
FOR i FROM 1 TO 60 DO
Find all posts by this user
Quote this message in a reply
04-09-2015, 10:59 AM
Post: #3
RE: Array
There were a few errors in the code you've shown but this should work:

Code:

EXPORT Test()
BEGIN
  Local i;
  Local T45BL:= [5128122, 280602, 277693, 173237, 55413,
                46271, 32573, 17198, 9266, 8822,
                8216, 4324, 4200, -3359, 2463,
                2211, 2065, -1870, 1828, -1794,
                -1749, -1565, -1491, -1475, -1410,
                -1344, -1335, 1107, 1021, 833,
                777, 671, 607, 596, 491,
                -451, 439, 422, 421, -366,
                -351, 331, 315, 302, -283,
                -229, 223, 223, -220, -220,
                -185, 181, -177, 176, 166,
                -164, 132, -119, 115, 107];

  for i from 1 to 60 do
    print(T45BL(i));
  end; // ends for 

END;
Find all posts by this user
Quote this message in a reply
04-09-2015, 11:06 AM
Post: #4
RE: Array
Would you be able to make use of the length() command in your loop?

Code:

EXPORT Test()
BEGIN
  Local i;
  Local T45BL:= [5128122, 280602, 277693, 173237, 55413,
                46271, 32573, 17198, 9266, 8822,
                8216, 4324, 4200, -3359, 2463,
                2211, 2065, -1870, 1828, -1794,
                -1749, -1565, -1491, -1475, -1410,
                -1344, -1335, 1107, 1021, 833,
                777, 671, 607, 596, 491,
                -451, 439, 422, 421, -366,
                -351, 331, 315, 302, -283,
                -229, 223, 223, -220, -220,
                -185, 181, -177, 176, 166,
                -164, 132, -119, 115, 107];

  for i from 1 to length(T45BL) do
    print(T45BL(i));
  end; // ends for 

END;
Find all posts by this user
Quote this message in a reply
04-09-2015, 02:27 PM
Post: #5
RE: Array
Thanks, this is great!


Would you be able to make use of the length() command in your loop?

Code:

EXPORT Test()
BEGIN
  Local i;
  Local T45BL:= [5128122, 280602, 277693, 173237, 55413,
                46271, 32573, 17198, 9266, 8822,
                8216, 4324, 4200, -3359, 2463,
                2211, 2065, -1870, 1828, -1794,
                -1749, -1565, -1491, -1475, -1410,
                -1344, -1335, 1107, 1021, 833,
                777, 671, 607, 596, 491,
                -451, 439, 422, 421, -366,
                -351, 331, 315, 302, -283,
                -229, 223, 223, -220, -220,
                -185, 181, -177, 176, 166,
                -164, 132, -119, 115, 107];

  for i from 1 to length(T45BL) do
    print(T45BL(i));
  end; // ends for 

END;
[/quote]
Find all posts by this user
Quote this message in a reply
Post Reply 




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