Strange "Type mismatch"

Post Reply
User avatar
Dutchman
Posts: 151
Joined: Tue Aug 06, 2019 4:47 pm
Location: Netherlands

Strange "Type mismatch"

Post by Dutchman » Mon Nov 04, 2019 12:57 pm

I don't understand "Type mismatch" in the following code:

Code: Select all

CLS
CALL Test
DIM A()=("a","b","c")
A=Test.A ' this works
FOR i=0 TO 3 : PRINT A(i); : NEXT I
'
' this gives "Type mismatch:
DIM B()=Test.A 
END

DEF Test
DIM A()=(1,2,3,4)
END DEF
.
Although A() is different in size and already contains data, it can indirectly get the value of Test.A().
If I immediately want to make B() equal to Test, A(), then I get the error message "Type mismatch". :?
It is still a long way to go

User avatar
kibernetik
Site Admin
Posts: 142
Joined: Tue Aug 06, 2019 3:03 pm

Re: Strange "Type mismatch"

Post by kibernetik » Mon Nov 04, 2019 12:59 pm

This construction is incorrect:

Code: Select all

DIM B()=Test.A
In array definition only direct array elements assignment is allowed. Assignment to another array in the DIM statement is not possible.
So, this "Type mismatch" error tells you that 'Test.A' object type is not correct.

User avatar
Dutchman
Posts: 151
Joined: Tue Aug 06, 2019 4:47 pm
Location: Netherlands

Re: Strange "Type mismatch"

Post by Dutchman » Mon Nov 04, 2019 1:57 pm

OK, thanks
It is still a long way to go

Post Reply