[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New warning from compiler about loop variables
[Thread Prev] | [Thread Next]
- Subject: Re: New warning from compiler about loop variables
- From: BB <adamnt42@xxxxxxxxx>
- Date: Tue, 29 Sep 2026 17:52:59 +0930
- To: user@xxxxxxxxxxxxxxxxxxxxxx
On 29/9/26 1:37 pm, Lee wrote:
Yes, it has been a while but my recollection is that it is a bit simpler and a bit more complex.On 9/28/26 6:47 PM, Brian G wrote:I have discovered that many many of my loop variables are duplicated I think there was a while where the code editor was adding a definitionwhen you used the variable.. must be because i don't think i used a dim in most cases of a loopand there it was right at the top of the function... Does anyone else remember this happening?Not sure what you mean by, "a while", as if the editor stopped doing that. To my recollection, it has been doing that for some time now.If you do: For x = 1 To 10 ' do something Nextand 'x' has not been previously declared, the editor will add the declaration.If you do: For x As Integer = 1 To 10 ' do something Next the editor will not add the declaration.
Consider: Dim X as Integer 'X is declared and has value of zero For X = 6 to 123 ' X is set to 6 and do something Next ' X is incremented Print X ' Prints 123 For X as Integer = 1 to 12 ' X is declared as a*new Integer local to the loop* do something Next Print X ' Prints 123 I could be wrong. It's just what I recall. b
| Re: New warning from compiler about loop variables | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
| New warning from compiler about loop variables | Brian G <brian@xxxxxxxxxxxxxxxx> |
| Re: New warning from compiler about loop variables | Lee <t.lee.davidson@xxxxxxxxx> |