[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Numeric for loop: Changing control variable REALLY dangerous?
- From: bil til <biltil52@...>
- Date: Mon, 12 Dec 2022 12:27:23 +0100
Am Mo., 12. Dez. 2022 um 11:40 Uhr schrieb Buergel, Thomas
<thomas.buergel@varian.com>:
>
> I'm not sure how the OP gets the impression that it behaves in a way such that modification of the loop variable would have any effect.
>
> A simple test with Lua 5.1 with the REPL:
>
> > lua
> Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> > for i=1,10 do
> >> print(i)
> >> if i==2 then i=6 print("modified i to ", i) end
...
ups sorry ... this hits me by surprise ... I could have checked this
myself of course before making such a fuzz here... please excuse...
... I am quite stunned, that somehow here this stack variable i seems
to be readable but not writable... so this is a variable type which I
really would not have expected at all... .
ok ... no more questions, please excuse... .