Problem using List

JDarter

Member
Licensed User
Longtime User
What am I doing wrong?
The code below using a simple list.add command returns a compilation error saying "java 474: not a statement"
The checkbox for the core library is checked. Why doesn't this work?


Sub Button2_Click

Dim List1, x as Long
List1.Initialize

For x=0 to 9
List1.Add(x)
Next x

End Sub
 

JDarter

Member
Licensed User
Longtime User
That was just a typo on my part... the line should be:

Dim List1 as List, x as Long

but it still doesn't work!



Any ideas??
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
Try
B4X:
Sub Button2_Click

Dim List1 As List, x as Long
List1.Initialize

For x=0 to 9
List1.Add(x)
Next

End Sub

As you should not specify "x" in the next statement line.
 
Upvote 0

JDarter

Member
Licensed User
Longtime User
That did it! Using just NEXT instead of NEXT x fixed the bogus List error I was getting.

Thanks for saving my sanity lol.
 
Upvote 0
Top