the code to reproduce a minor compiler error.
Code: Select all
FUNCTION Start( ) AS VOID
VAR x := ""
x := "Test1"
IF 1==1
x := "Test2" //compiler error 'Cannot use local variable 'x' before it is used
VAR x := "" //redefinition
x := "Test3"
ENDIF
RETURN
In my current project there were some warnings between the errors (so I didn't saw the second error message). So I tried to solve the first one which is only solvable by deleting or rename the second declaration. After some time I did go on with cleaning the other errors. After deleting the redeclaration of x (which was copy/paste stuff) 'magically' the first error has gone.
Maybe the first error message can be ignored if the variable is declared in enclosing scope.
Stefan