[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: brian <brian@xxxxxxxxxxxxxxxx>
- Date: Tue, 29 Sep 2026 06:42:27 -0700
- To: user@xxxxxxxxxxxxxxxxxxxxxx
The issue is if you declare a var and use it for something . And then by accident use and declare the same one in a loop. There was no error or warning you are left debugging .... Guilty as myself of that. Every other language would make that an error. On September 29, 2026 3:31:56 AM PDT, Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> wrote: >> 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 don't think so... At least the memory address do not change and thus >what would be the issue? > >Dim n As Integer >Print "initial; ";; VarPtr(n) > >For n As Integer = 0 To 0 >Print "inside; ";; VarPtr(n) >Next > >Print "at the end; ";; VarPtr(n) > > >Jussi > >> ~~~Brian
| 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> |
| Re: New warning from compiler about loop variables | BB <adamnt42@xxxxxxxxx> |
| Re: New warning from compiler about loop variables | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |