Need help on Code

positrom2

Active Member
Licensed User
Longtime User
The following code snippet
B4X:
852 Dim mittelwert As Double, streuung As Double, s As Double
   For j=2 To steps-1
   s=s+maxr_array(j,0)
   Next
mittelwert=s/(steps-2)
s=0
For j=2 To steps-1
s=mittelwert-maxr_array(j,0)
s=s+Power(s,2)
Next
streuung=Sqrt(s/(steps-2))
throws the error
Error description: Current declaration does not match previous one.
Previous: {Type=Float,Rank=0}
Current: {Type=Double,Rank=0}
Occurred on line: 852
Dim mittelwert As Double, streuung As Double, s As Double
Word: ,
Those variables are not declared elsewhere.
Thanks, positrom2
 

positrom2

Active Member
Licensed User
Longtime User
You must have declared one of the variables somewhere else.
No, using "show all references" does not reveal additional declaration of any of those three variables. The error message also is looking strange.
Being stumped (ratlos).
positrom2
 
Upvote 0

grant1842

Active Member
Licensed User
Longtime User
Is there any way you could post your project? I had a similar issue before. I would have for example:

Dim I as Int

Then many lines of code later I would have

Dim I as Double

Both in the same Sub. The compiler would gripe and say the same thing you're getting.
 
Upvote 0

positrom2

Active Member
Licensed User
Longtime User
Solved:
"Dim mittelwert" indeed occured twice as suggested by Klaus.
To my favor I found that "find all references" does not list all references (just the most adjacent "Dim" statement) (B4A 2.52).
I also observed earlier that "find all references" occasionally was refusing to list the "Dim" of a variable (even it is occuring just once).
So the "all" is somewhat misleading. Suggestion: should be removed.
positrom2
 
Upvote 0
Top