Android Question Beta 3.0 - problem in For (illegal start of expressionfor)

stefanoa

Active Member
Licensed User
Longtime User
i've this error in Debug (rapid) on line: For n = 0 To fileList.Size - 1

in module:

Code:
B4X:
Sub ListFolderContent(folder AsString) As String

Dim fileList As List

Dim n AsInt

fileList = File.ListFiles(path1)
fileList.Sort(True)


For n = 0To fileList.Size - 1
file1 = fileList.Get(n)
ListView1.AddSingleLine(file1)

Next

End Sub
 

pappicio

Active Member
Licensed User
Longtime User
no problem compiling the code, but a lot of error inside: chek it better.....
B4X:
Sub ListFolderContent(folder AsString) As String

    Dim fileList AsList

    Dim n As Int

    fileList = File.ListFiles(path1)
    fileList.Sort(True)
    For n = 0 To fileList.Size - 1
        file1 = fileList.Get(n)
        ListView1.AddSingleLine(file1)
    Next
End Sub

try this one!
 
Upvote 0

sanduro

Member
Licensed User
Longtime User
I have a same problem, looks like Debug(legacy) works fine but Debug(rapid) has a problem, i suspect it is casting the For varable to integer ....

San

Parsing code. 0.01
Compiling code. Error
Error compiling program.
Error description: Regular variable followed by '=' expected.
Occurred on line: 42
For i = 135 To 400 Step 7.5
Word: .
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
I'm getting this on the current release, Version 3.50 on the following code:
B4X:
    For I  = 0 To WheelNb - 1
       ...
Next
HOWEVER, the variable I is a global variable, but is being used in a sub. Even though I dimension a NEW variable I within the sub, it causes this problem. By merely changing the variable I within the sub to X (for example),
B4X:
For x = 0 to WheelNb 01
...
Next
the compiler error goes away.
Rusty
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…