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

Parsing code. 1.38
Compiling code. 2.25
Compiling layouts code. 0.17
Generating R file. 0.79
Compiling debugger engine code. Error
B4A line: 341For n = 0To fileList.Size - 1
javac 1.6.0_45
shell\src\bloomob\mylifebook\birthdays_subs_0.java:1216: illegal start of expressionfor (_n = BA.numberCast(int.class, 0); (step201 > 0 && _n.<Integer>get().intValue() <= limit201) || (step201 < 0 && _n.<Integer>get().intValue() >= limit201); _n = RemoteObject.createImmutable((int)(_n.<Integer>get().intValue() + step201))) {
^1 error
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
Top