I found some inconveniences with items to be scanned with Array Scan.
(The arrays I use always start with index = 0.)
I have to test if a certain item value is already at least once in the array.
Dim c() As Integer
ReDim c(10)
c(1) = 11
c(2) = 12
Array Scan c(), =11, To iRet ' I'm searching for 11
'iRet = 2 because "Array Scan" is based on 1. That's correct.
ReDim c(10)
c(1) = 11
c(2) = 12
Array Scan c(), =0, To iRet ' I'm searching for 0
'iRet = 1 ? Why? I did not define c(0).
ReDim c(10)
c(5) = 11
c(6) = 12
Array Scan c(), =0, To iRet ' I'm searching for 0
'iRet = 1 ? Why? I did not define c(0...4)
ReDim c(10)
c(0) = 0
c(5) = 11
c(6) = 12
Array Scan c(), =0, To iRet
'iRet = 1. This seems to be ok on the first sight, because iRet = 1
'But when I assign one of the Items(0...4) with value 0, iRet is always 1.
ReDim c(10)
c(0) = 10
c(5) = 0
c(6) = 12
Array Scan c(), =0, To iRet
'iRet = 1. This is not ok, because iRet = 1
'So, I cannot scan for a value = 0 which is essential to me.
What could I do?
(The arrays I use always start with index = 0.)
I have to test if a certain item value is already at least once in the array.
Dim c() As Integer
ReDim c(10)
c(1) = 11
c(2) = 12
Array Scan c(), =11, To iRet ' I'm searching for 11
'iRet = 2 because "Array Scan" is based on 1. That's correct.
ReDim c(10)
c(1) = 11
c(2) = 12
Array Scan c(), =0, To iRet ' I'm searching for 0
'iRet = 1 ? Why? I did not define c(0).
ReDim c(10)
c(5) = 11
c(6) = 12
Array Scan c(), =0, To iRet ' I'm searching for 0
'iRet = 1 ? Why? I did not define c(0...4)
ReDim c(10)
c(0) = 0
c(5) = 11
c(6) = 12
Array Scan c(), =0, To iRet
'iRet = 1. This seems to be ok on the first sight, because iRet = 1
'But when I assign one of the Items(0...4) with value 0, iRet is always 1.
ReDim c(10)
c(0) = 10
c(5) = 0
c(6) = 12
Array Scan c(), =0, To iRet
'iRet = 1. This is not ok, because iRet = 1
'So, I cannot scan for a value = 0 which is essential to me.
What could I do?
Comment