Missing '(' error

petrbury

Member
Licensed User
Longtime User
Hi,
I have a problem with my program in version 5. In version 4 it works, but in new version I'm getting an error message :
Error description: Missing '(' after array variable.
For i= 0 to ArrayLen(DecInput) - 1

This is a part of program where error occurs.

Sub Globals
Dim DecInput(100)
End Sub

Sub App_Start
Form1.Show
DecInput() = serial.InputArray

For i = 0 to ArrayLen(DecInput) - 1
'something
Next i
End Sub


Could anybody help me, please ? :sign0085:

Thanks
Petr
 

wolfgang

Member
Licensed User
Longtime User
Hi petrbury,
this should work
B4X:
For i = 0 to ArrayLen(DecInput()) - 1
 

Cableguy

Expert
Licensed User
Longtime User
Hi
I dont think you need the ArrayLen(DecInput) - 1 as by defenition arraylenght is from 0 to arraylenghth-1

so in your case arraylen is 99

Try the followin:

MsgBox(ArrayLen(decInput))

it shoul give you 99
 

petrbury

Member
Licensed User
Longtime User
Thank you Wolfgang, I just wanted edit my question - I found it allready . It was my mistake ( but in version 4 it worked).
I wonder how many errors are waiting for me in my old applications :sign0161: .
Petr
 

petrbury

Member
Licensed User
Longtime User
Hi Cableguy,
in my case the array DecInput is filled from serial com, so I don't know how many bytes are in it. That's the reason I use this way.
Petr
 
Top