X11Basic icon indicating copy to clipboard operation
X11Basic copied to clipboard

strange behavior of colon operator

Open amaendle opened this issue 4 years ago • 2 comments

I fear there might be something wrong with the colon operator for arrays:

foo() = [1,2,3] dim b(3) b(0:1)=foo(1:2)

print b(0) 2 print b(1) 0

I expect print b(1) to be 2 and print b(0) to be 1.

Another experiment:

d()= foo(1:2)

print d(0) 2 print d(1) 2

I think print d(0) should be 1.

What is going on? Am I doing something wrong?

amaendle avatar Oct 02 '20 15:10 amaendle

No this is a bug. It needs more testing. Maybe always one element is ommited at the end?

kollokollo avatar Oct 05 '20 06:10 kollokollo

The issue is not yet solved. However, now there will be an error message:

ERROR at line 2: Array  dimensioning mismatch

kollokollo avatar Aug 18 '22 09:08 kollokollo