Only in Debug mode (in release mode it is not a problem)!
When one uses a variable for a 'for' loop, you can't re-use it as a dim later
Error:
Code to reproduce:
When one uses a variable for a 'for' loop, you can't re-use it as a dim later
Error:
B4X:
B4J Version: 6.01
Parsing code. (0.00s)
Compiling code. Error
Error compiling program.
Error description: Current declaration does not match previous one.
Make sure to declare the variable before it is used in a For loop.
Error occurred on line: 17
Dim i As Int
Code to reproduce:
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
For i = 0 To 10 ' <----- used the i variable
Log(i)
Next
For k = 0 To 10
Dim i As Int ' <------ now using it 'normal', gives the error
i = k
Log(k)
Next
StartMessageLoop
End Sub